-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Add Max Session to WebFlux #6192
Comments
We do not currently support max sessions in WebFlux. I converted this issue into a ticket for that support |
Can I give it a try?? |
@ankurpathak Sure! The ticket is yours |
@rwinch I would like to dicusss this ticket progressively:
|
@rwinch What is equivalent of SessionRegistry in reactive world? |
We don't currently have an equivalent. Note: I'd try and reimagine the API a bit rather than copy it directly. See exactly what is needed by Spring Security and limit it to that. |
@rwinch |
@rwinch |
@mukeshkamboj @rwinch I am not working on this. |
@rwinch |
Is this ticket still considered relevant? |
Is there any workaround for it in webflux using ReactiveRedisSessionRepository |
Any progress of this issue? |
Hi, any progress or suggestions on this? |
Hi, any progress or suggestions on this issue ? |
Hi, any progress or suggestions on this? |
1 similar comment
Hi, any progress or suggestions on this? |
this seems to be a long way, since authorization server is focused in Oauth2 patterns with spring security team i don't see coming this feature soon |
Any Progress on this? |
Hi everyone, that has been no progress yet on this. Please give a thumbs up to the root comment if you would like to see this feature in Spring Security, this helps us prioritize issues. If anyone is interested in working on this feature, you are welcome. |
For those waiting for this, the initial support is available in Spring Security 6.3.0-M1, please give it a try and, if possible, report any issues/enhancements. The docs are available at https://docs.spring.io/spring-security/reference/6.3/reactive/authentication/concurrent-sessions-control.html |
The reactive implementation of max sessions does not keep track of expired sessions, therefore we do not need such parameter Issue gh-6192
This commit changes the PreventLoginServerMaximumSessionsExceededHandler to invalidate the WebSession in addition to throwing the error, this is needed otherwise the session would still be saved with the security context. It also changes the SessionRegistryWebSession to first perform the operation on the delegate and then invoke the needed method on the ReactiveSessionRegistry Issue gh-6192
Add WebSessionStore constructor parameter to the handler Issue gh-6192
Delete WebSessionStoreReactiveSessionRegistry.java and gives the responsibility to remove the sessions from the WebSessionStore to the handler Issue gh-6192
the example seems to not be working on the 3.3.0-RC1 (I'm using OAuthLogin), this is my config: @Bean
SecurityWebFilterChain springSecurityFilterChain(ServerHttpSecurity http) {
http
.authorizeExchange(authorizeRequests -> authorizeRequests
.anyExchange()
.authenticated()
)
.sessionManagement(sessions -> sessions
.concurrentSessions(concurrency -> concurrency
.maximumSessions(SessionLimit.of(1))
.maximumSessionsExceededHandler(new PreventLoginServerMaximumSessionsExceededHandler())
)
)
.csrf(ServerHttpSecurity.CsrfSpec::disable)
.oauth2Login(withDefaults())
.logout(logout -> logout
.logoutSuccessHandler(oidcLogoutSuccessHandler())
)
.oauth2Client(withDefaults());
return http.build();
}
@Bean
ReactiveSessionRegistry reactiveSessionRegistry() {
return new InMemoryReactiveSessionRegistry();
} |
Hi @jsantana3c, can you provide a minimal, reproducible sample? |
Here you go, https://github.com/joaquinjsb/security-oauth-example |
When i am using webflux , how can i achieve a similar effect ,get all login user session ,
like as :
http.sessionManagement() .maximumSessions(1).sessionRegistry(getSessionRegistry()).maxSessionsPreventsLogin(false)
The text was updated successfully, but these errors were encountered: