-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Closed
Labels
in: configAn issue in spring-security-configAn issue in spring-security-configstatus: backportedAn issue that has been backported to maintenance branchesAn issue that has been backported to maintenance branchestype: bugA general bugA general bug
Milestone
Description
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
@Configuration
@EnableWebFluxSecurity
@EnableWebFlux
public class Main extends AbstractReactiveWebInitializer {
@Bean
public SecurityWebFilterChain springSecurityFilterChain (ServerHttpSecurity http) {
return http
.securityContextRepository (securityContextRepository ())
.formLogin ()
.and ()
.logout ()
.logoutUrl ("/logout")
.and ()
.build ();
}
@Bean
public ServerSecurityContextRepository securityContextRepository () {
return new CustomSecurityContextRepository ();
}
@Bean
public ReactiveUserDetailsService userDetailsService () {
var user = User.withDefaultPasswordEncoder ()
.username ("user")
.password ("user")
.roles ("USER")
.build ();
return new MapReactiveUserDetailsService (user);
}
@Override
protected Class<?>[] getConfigClasses () {
return new Class<?>[] { Main.class };
}
}
Version
- Spring Security : 5.3.0.RELEASE
- Spring Framework : 5.2.5.RELEASE
Sample
https://github.com/EtienneMiret/spring-security-logout
Metadata
Metadata
Assignees
Labels
in: configAn issue in spring-security-configAn issue in spring-security-configstatus: backportedAn issue that has been backported to maintenance branchesAn issue that has been backported to maintenance branchestype: bugA general bugA general bug