#BAEL-5443: add logout config
This commit is contained in:
parent
bca12a0764
commit
898661f142
|
@ -13,6 +13,12 @@ import org.springframework.security.web.authentication.session.SessionAuthentica
|
||||||
@EnableWebSecurity
|
@EnableWebSecurity
|
||||||
class SecurityConfig extends WebSecurityConfigurerAdapter {
|
class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||||
|
|
||||||
|
private final KeycloakLogoutHandler keycloakLogoutHandler;
|
||||||
|
|
||||||
|
SecurityConfig(KeycloakLogoutHandler keycloakLogoutHandler) {
|
||||||
|
this.keycloakLogoutHandler = keycloakLogoutHandler;
|
||||||
|
}
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
protected SessionAuthenticationStrategy sessionAuthenticationStrategy() {
|
protected SessionAuthenticationStrategy sessionAuthenticationStrategy() {
|
||||||
return new RegisterSessionAuthenticationStrategy(new SessionRegistryImpl());
|
return new RegisterSessionAuthenticationStrategy(new SessionRegistryImpl());
|
||||||
|
@ -25,7 +31,11 @@ class SecurityConfig extends WebSecurityConfigurerAdapter {
|
||||||
.hasRole("USER")
|
.hasRole("USER")
|
||||||
.anyRequest()
|
.anyRequest()
|
||||||
.permitAll();
|
.permitAll();
|
||||||
http.oauth2Login();
|
http.oauth2Login()
|
||||||
|
.and()
|
||||||
|
.logout()
|
||||||
|
.addLogoutHandler(keycloakLogoutHandler)
|
||||||
|
.logoutSuccessUrl("/");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue