79119584

Date: 2024-10-23 20:20:51
Score: 0.5
Natty:
Report link

Have you tried to concatenate the matchers and specify the HttpMethod to reduce the scope of the matcher, like this:

@Bean 
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception { 
    LOG.info("SSO is disabled. Continuing using LDAP Authentication."); 

    http.csrf(AbstractHttpConfigurer::disable)
        .authorizeHttpRequests(req -> req.requestMatchers("/login").permitAll())
        .authorizeHttpRequests(
            req ->
                req.requestMatchers(
                        HttpMethod.GET,
                        "/images/**",
                        "/js/**",
                        "/css/**",
                        "/webjars/**",
                        "/resources/**",
                        "/jakarta.faces.resource/**",
                        "/jakarta.faces.resource/images/**")
                    .permitAll());

    return http.build(); 
} 

Removing both the anyRequest().permitAll() and the definition of the WebSecurityCustomizer bean?

Reasons:
  • Whitelisted phrase (-1): Have you tried
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Ends in question mark (2):
  • Low reputation (0.5):
Posted by: Francesco Poli