in tests-creation/security-config/java/src/main/java/com/epam/aicode/java/AppSecurityConfig.java [33:45]
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.csrf().disable()
.authorizeHttpRequests((authorize) -> authorize
.requestMatchers(HttpMethod.POST).permitAll()
.requestMatchers("/login").permitAll()
.requestMatchers("/admin").hasRole(Role.ADMIN.name())
.anyRequest().authenticated()
)
.formLogin(withDefaults())
.httpBasic(withDefaults());
return http.build();
}