if (event instanceof AbstractAuthenticationFailureEvent) {
LOGGER.warn("Erreur d'authentification: {}", new Object[]{event});
}
if (event instanceof AuthenticationSuccessEvent) {
AuthenticationSuccessEvent authenticationSuccessEvent = (AuthenticationSuccessEvent) event;
String username = authenticationSuccessEvent.getAuthentication().getName();
User user = userAuthService.findUserByUserName(username);
// sauvergarde en session de la précédente date de connexion
HttpServletRequest request = (HttpServletRequest) ( (ServletRequestAttributes) RequestContextHolder.getRequestAttributes() ).getRequest();
request.getSession().setAttribute("lastLogin", user.getLastLogin());
// mise à jour de la date de connexion.