I am using spring-security-oauth2 client for oauth2 client and my front end is angular application.
I am trying to implement auto logout in case , there is a session timeout. so far I am unsuccessful.
this is my bean code. I am setting invalidSessionUrl("auth server logout url") in the httpSecurity DSL. This is the code reference I am having https://docs.spring.io/spring-security/reference/servlet/authentication/session-management.html#clearing-session-cookie-on-logout
@Bean public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.headers(headersConfig ->
headersConfig
.frameOptions(HeadersConfigurer.FrameOptionsConfig::sameOrigin)
)
.sessionManagement(sessionConfig -> sessionConfig.invalidSessionUrl("http://localhost:8080/authserver/logout?redirect_uri=http://localhost:8080/test&client_id=test"))
.authorizeHttpRequests(authorize -> authorize
.anyRequest().authenticated()
)
.oauth2Login(oauth2Config -> oauth2Config
.authorizationEndpoint(authorizationEndpointConfig -> authorizationEndpointConfig
.authorizationRequestResolver(
authorizationRequestResolver(clientRegistrationRepository)
)
)
)
.csrf(csrfConfig ->
csrfConfig.disable()
);
return http.build();
} on invalidsession, I am redirecting to the authserver logout page. But when the request is made, on session expiry it is not trying to parse the json request. Instead it show show the logout page. Is it possible?
