Open matheusromano opened 2 weeks ago
Found a solution. using this code:
@Bean SecurityFilterChain configureSecurity(HttpSecurity http) throws Exception { http .authorizeHttpRequests(authz -> authz .requestMatchers("/login").permitAll() .requestMatchers("/", "/search").authenticated() .requestMatchers(HttpMethod.GET, "/api/").authenticated() .requestMatchers(HttpMethod.POST, "/new-video", "/api/").hasRole("ADMIN") .anyRequest().denyAll() ) .formLogin(Customizer.withDefaults()) .httpBasic(Customizer.withDefaults());
return http.build();
}
@Bean SecurityFilterChain configureSecurity(HttpSecurity http) throws Exception { http.authorizeHttpRequests() // .requestMatchers("/login").permitAll() // .requestMatchers("/", "/search").authenticated() // .requestMatchers(HttpMethod.GET, "/api/") .authenticated() // .requestMatchers(HttpMethod.POST, "/new-video", "/api/").hasRole("ADMIN") // .anyRequest().denyAll() // .and() // .formLogin() // .and() // .httpBasic(); return http.build(); }
some methods of this security polices are deprecated, and i cant build my project with this code.