Commit d9d3db71 authored by Lukáš Chudíček's avatar Lukáš Chudíček
Browse files

fix: added security for a new endpoint in recommender

parent b93b770e
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -34,11 +34,13 @@ public class SecurityConfig {
        // todo extract from properties
        final String RECOMMEND_GET_SCOPE = "SCOPE_test_1";
        final String BEST_RATED_IN_GENRE_GET_SCOPE = "SCOPE_test_2";
        final String RECOMMENDED_MOVIES_ACCORDING_TO_RATING_IN_SAME_GENRE_GET_SCOPE = "SCOPE_test_3";

        http
                .authorizeHttpRequests(x -> x
                        .requestMatchers(HttpMethod.GET, "/recommend/{id}").hasAuthority(RECOMMEND_GET_SCOPE)
                        .requestMatchers(HttpMethod.GET, "/best-rated-in-genre/{id}").hasAuthority(BEST_RATED_IN_GENRE_GET_SCOPE)
                        .requestMatchers(HttpMethod.GET, "/recommended-movies-according-to-rating-in-same-genre/{id}").hasAuthority(RECOMMENDED_MOVIES_ACCORDING_TO_RATING_IN_SAME_GENRE_GET_SCOPE)
                        // defensively deny all other requests
                        .anyRequest().denyAll()
                )