Skip to content

Commit

Permalink
Reorder antMatchers
Browse files Browse the repository at this point in the history
to fix iam test client app
  • Loading branch information
rmiccoli committed Sep 19, 2024
1 parent e1c38d6 commit f0378bc
Showing 1 changed file with 17 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,25 +73,23 @@ public class IamTestClientConfiguration {
private IamClientApplicationProperties iamClientConfig;

@Bean
SecurityFilterChain filterChain(HttpSecurity http, OIDCAuthenticationFilter oidcFilter) throws Exception {

http.authorizeHttpRequests(requests -> requests
.antMatchers("/**")
.authenticated()
.antMatchers("/", "/user", "/error", "/openid_connect_login**", "/webjars/**")
.permitAll())
.exceptionHandling(handling -> handling
.authenticationEntryPoint(new SendUnauhtorizedAuthenticationEntryPoint()))
.logout(logout -> logout
.logoutSuccessUrl("/")
.permitAll())
.csrf(csrf -> csrf
.csrfTokenRepository(csrfTokenRepository()))
.addFilterAfter(csrfHeaderFilter(), CsrfFilter.class)
.addFilterAfter(oidcFilter, SecurityContextPersistenceFilter.class)
.sessionManagement(management -> management
.enableSessionUrlRewriting(false)
.sessionCreationPolicy(SessionCreationPolicy.ALWAYS));
SecurityFilterChain filterChain(HttpSecurity http, OIDCAuthenticationFilter oidcFilter)
throws Exception {

http
.authorizeHttpRequests(requests -> requests
.antMatchers("/", "/user", "/error", "/openid_connect_login**", "/webjars/**")
.permitAll()
.antMatchers("/**")
.authenticated())
.exceptionHandling(handling -> handling
.authenticationEntryPoint(new SendUnauhtorizedAuthenticationEntryPoint()))
.logout(logout -> logout.logoutSuccessUrl("/").permitAll())
.csrf(csrf -> csrf.csrfTokenRepository(csrfTokenRepository()))
.addFilterAfter(csrfHeaderFilter(), CsrfFilter.class)
.addFilterAfter(oidcFilter, SecurityContextPersistenceFilter.class)
.sessionManagement(management -> management.enableSessionUrlRewriting(false)
.sessionCreationPolicy(SessionCreationPolicy.ALWAYS));

return http.build();
}
Expand Down

0 comments on commit f0378bc

Please sign in to comment.