-
Notifications
You must be signed in to change notification settings - Fork 6k
Global ServerSecurityContextRepository ignored by logout #8375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for the report. I have confirmed this is an issue. I will push a fix out. In the meantime, you can work around it by explicitly providing a logout handler. So changing your example to be something like this would work: @Bean
public SecurityWebFilterChain springSecurityFilterChain (ServerHttpSecurity http, ServerSecurityContextRepository repository) {
SecurityContextServerLogoutHandler handler = new SecurityContextServerLogoutHandler();
handler.setSecurityContextRepository(repository);
return http
.securityContextRepository (repository)
.formLogin ()
.and ()
.logout ()
.logoutHandler(handler)
.logoutUrl ("/logout")
.and ()
.build ();
}
@Bean
public ServerSecurityContextRepository securityContextRepository () {
return new CustomSecurityContextRepository ();
} |
Thanks again for the ticket. This is fixed in master and backported to 5.3.x 5.2.x and 5.1.x. |
You’re welcome. I’m glad it was indeed an issue, and not a misunderstanding on my side. I would’ve hated to waste your time. |
No problem. Did the workaround work for you in the meantime? |
Yes! The workaround works fine. Thank you! |
Summary
When configuring a global ServerSecurityContextRepository on the SecurityWebFilterChain, it is used by all authentication mechanisms (since #7249) but not by the logout handler.
Actual Behavior
When configuring a custom ServerSecurityContextRepository, the SecurityContextServerLogoutHandler still uses the default WebSessionServerSecurityContextRepository.
Expected Behavior
I’d expect that the ServerHttpSecurity.securityContextRepository () method sets the ServerSecurityContextRepository everywhere.
Configuration
Version
Sample
https://github.com/EtienneMiret/spring-security-logout
The text was updated successfully, but these errors were encountered: