|
Spring Security Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.security.concurrent.ConcurrentSessionControllerImpl
public class ConcurrentSessionControllerImpl
Base implementation of ConcurrentSessionControllerImpl
which prohibits simultaneous logins.
By default
uses SessionRegistryImpl
, although any SessionRegistry
may be used.
Field Summary | |
---|---|
protected MessageSourceAccessor |
messages
|
Constructor Summary | |
---|---|
ConcurrentSessionControllerImpl()
|
Method Summary | |
---|---|
void |
afterPropertiesSet()
|
protected void |
allowableSessionsExceeded(String sessionId,
SessionInformation[] sessions,
int allowableSessions,
SessionRegistry registry)
Allows subclasses to customise behaviour when too many sessions are detected. |
void |
checkAuthenticationAllowed(Authentication request)
Called by any class that wishes to know whether the current authentication request should be permitted. |
protected int |
getMaximumSessionsForThisUser(Authentication authentication)
Method intended for use by subclasses to override the maximum number of sessions that are permitted for a particular authentication. |
SessionRegistry |
getSessionRegistry()
|
void |
registerSuccessfulAuthentication(Authentication authentication)
Called by an AuthenticationManager when the authentication was successful. |
void |
setExceptionIfMaximumExceeded(boolean exceptionIfMaximumExceeded)
|
void |
setMaximumSessions(int maximumSessions)
|
void |
setMessageSource(MessageSource messageSource)
|
void |
setSessionRegistry(SessionRegistry sessionRegistry)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected MessageSourceAccessor messages
Constructor Detail |
---|
public ConcurrentSessionControllerImpl()
Method Detail |
---|
public void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception
protected void allowableSessionsExceeded(String sessionId, SessionInformation[] sessions, int allowableSessions, SessionRegistry registry)
sessionId
- the session ID of the present requestsessions
- either null
or all unexpired sessions associated with the principalallowableSessions
- DOCUMENT ME!registry
- an instance of the SessionRegistry
for subclass use
ConcurrentLoginException
- DOCUMENT ME!public void checkAuthenticationAllowed(Authentication request) throws AuthenticationException
ConcurrentSessionController
AuthenticationManager
s before they authenticate, but could equally
include Filter
s or other interceptors that wish to confirm the ongoing validity of a previously
authenticated Authentication
.The implementation should throw a suitable exception if the user has exceeded their maximum allowed concurrent sessions.
checkAuthenticationAllowed
in interface ConcurrentSessionController
request
- the authentication request (never null
)
AuthenticationException
- if the user has exceeded their maximum allowed current sessionsprotected int getMaximumSessionsForThisUser(Authentication authentication)
maximumSessions
value
for the bean.
authentication
- to determine the maximum sessions for
public void registerSuccessfulAuthentication(Authentication authentication)
ConcurrentSessionController
AuthenticationManager
when the authentication was successful. An
implementation is expected to register the authenticated user in some sort of registry, for future concurrent
tracking via the ConcurrentSessionController.checkAuthenticationAllowed(Authentication)
method.
registerSuccessfulAuthentication
in interface ConcurrentSessionController
authentication
- the successfully authenticated user (never null
)public void setExceptionIfMaximumExceeded(boolean exceptionIfMaximumExceeded)
public void setMaximumSessions(int maximumSessions)
public void setMessageSource(MessageSource messageSource)
setMessageSource
in interface MessageSourceAware
public void setSessionRegistry(SessionRegistry sessionRegistry)
public SessionRegistry getSessionRegistry()
|
Spring Security Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |