if (user != null) {
putPrincipalInSessionContext(request, user);
getElevatedSecurityGuard().onSuccessfulLoginAttempt(request, username);
// Firing this event is necessary to ensure the user's personal information is initialised correctly.
getEventPublisher().publish(
new LoginEvent(this, username, request.getSession().getId(), remoteHost, remoteIP));
LoginReason.OK.stampRequestResponse(request, response);
LOGGER.debug("Logging in [{}] from CAS.", username);
} else {
LOGGER.debug("Failed logging [{}] from CAS.", username);
getElevatedSecurityGuard().onFailedLoginAttempt(request, username);