corrected ant matchers

This commit is contained in:
Jottyfan 2023-10-21 13:37:59 +02:00
parent 3147007632
commit b3a089d6b3

View File

@ -11,6 +11,7 @@ import org.springframework.security.oauth2.client.registration.InMemoryClientReg
import org.springframework.security.web.SecurityFilterChain; import org.springframework.security.web.SecurityFilterChain;
import org.springframework.security.web.authentication.session.NullAuthenticatedSessionStrategy; import org.springframework.security.web.authentication.session.NullAuthenticatedSessionStrategy;
import org.springframework.security.web.authentication.session.SessionAuthenticationStrategy; import org.springframework.security.web.authentication.session.SessionAuthenticationStrategy;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
/** /**
* *
@ -34,7 +35,12 @@ public class SecurityConfiguration {
// @formatter:off // @formatter:off
.oauth2Login(o -> o.defaultSuccessUrl("/")) .oauth2Login(o -> o.defaultSuccessUrl("/"))
.logout(o -> o.logoutSuccessHandler(new OidcClientInitiatedLogoutSuccessHandler(crr))) .logout(o -> o.logoutSuccessHandler(new OidcClientInitiatedLogoutSuccessHandler(crr)))
.authorizeHttpRequests(o -> o.requestMatchers("/dashboard/**", "/business/**", "/confirmation/**", "/userlogin/**").authenticated() .authorizeHttpRequests(o -> o.requestMatchers(
AntPathRequestMatcher.antMatcher("/dashboard/**"),
AntPathRequestMatcher.antMatcher("/business/**"),
AntPathRequestMatcher.antMatcher("/confirmation/**"),
AntPathRequestMatcher.antMatcher("/userlogin/**")
).authenticated()
.anyRequest().permitAll()) .anyRequest().permitAll())
.oauth2ResourceServer(o -> o.jwt(Customizer.withDefaults())) .oauth2ResourceServer(o -> o.jwt(Customizer.withDefaults()))
.sessionManagement(o -> o.init(sec)); .sessionManagement(o -> o.init(sec));