Stratégie d'authentification de session est le point de surveillance et de contrôle des tentatives de connexion. Il existe déjà un Stratégie de contrôle des sessions simultanées pour limiter les sessions connectées par le même nom d'utilisateur. Vous pouvez l'étendre ou vous en inspirer. et rediriger ou renvoyer vers une page d'erreur en SimpleUrlAuthenticationFailureHandler (Gestionnaire d'échec d'authentification simple) .
/**
* Strategy which handles concurrent session-control, in addition to the functionality provided by the base class.
*
* When invoked following an authentication, it will check whether the user in question should be allowed to proceed,
* by comparing the number of sessions they already have active with the configured <tt>maximumSessions</tt> value.
* The {@link SessionRegistry} is used as the source of data on authenticated users and session data.
* <p>
* If a user has reached the maximum number of permitted sessions, the behaviour depends on the
* <tt>exceptionIfMaxExceeded</tt> property. The default behaviour is to expired the least recently used session, which
* will be invalidated by the {@link ConcurrentSessionFilter} if accessed again. If <tt>exceptionIfMaxExceeded</tt> is
* set to <tt>true</tt>, however, the user will be prevented from starting a new authenticated session.
* <p>
* This strategy can be injected into both the {@link SessionManagementFilter} and instances of
* {@link AbstractAuthenticationProcessingFilter} (typically {@link UsernamePasswordAuthenticationFilter}).
*
* @author Luke Taylor
* @since 3.0
*/
public class ConcurrentSessionControlStrategy extends SessionFixationProtectionStrategy