Class ConcurrentSessionControlServerAuthenticationSuccessHandler
java.lang.Object
org.springframework.security.web.server.authentication.ConcurrentSessionControlServerAuthenticationSuccessHandler
- All Implemented Interfaces:
- ServerAuthenticationSuccessHandler
public final class ConcurrentSessionControlServerAuthenticationSuccessHandler
extends Object
implements ServerAuthenticationSuccessHandler
Controls the number of sessions a user can have concurrently authenticated in an
 application. It also allows for customizing behaviour when an authentication attempt is
 made while the user already has the maximum number of sessions open. By default, it
 allows a maximum of 1 session per user, if the maximum is exceeded, the user's least
 recently used session(s) will be expired.
- Since:
- 6.3
- See Also:
- 
Constructor SummaryConstructorsConstructorDescriptionConcurrentSessionControlServerAuthenticationSuccessHandler(ReactiveSessionRegistry sessionRegistry, ServerMaximumSessionsExceededHandler maximumSessionsExceededHandler) 
- 
Method SummaryModifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>onAuthenticationSuccess(WebFilterExchange exchange, Authentication authentication) Invoked when the application authenticates successfullyvoidsetSessionLimit(SessionLimit sessionLimit) Sets the strategy used to resolve the maximum number of sessions that are allowed for a specificAuthentication.
- 
Constructor Details- 
ConcurrentSessionControlServerAuthenticationSuccessHandlerpublic ConcurrentSessionControlServerAuthenticationSuccessHandler(ReactiveSessionRegistry sessionRegistry, ServerMaximumSessionsExceededHandler maximumSessionsExceededHandler) 
 
- 
- 
Method Details- 
onAuthenticationSuccesspublic reactor.core.publisher.Mono<Void> onAuthenticationSuccess(WebFilterExchange exchange, Authentication authentication) Description copied from interface:ServerAuthenticationSuccessHandlerInvoked when the application authenticates successfully- Specified by:
- onAuthenticationSuccessin interface- ServerAuthenticationSuccessHandler
- Parameters:
- exchange- the exchange
- authentication- the- Authentication
- Returns:
- a completion notification (success or error)
 
- 
setSessionLimitSets the strategy used to resolve the maximum number of sessions that are allowed for a specificAuthentication. By default, it returns1for any authentication.- Parameters:
- sessionLimit- the- SessionLimitto use
 
 
-