if (isLoggedIn()) {
// If authentication has already occurred during this request via a silent login,
// and login() is explicitly called then we still want to raise the LOGIN_SUCCESSFUL event,
// and then return.
if (requestSecurityState.get().isSilentLogin()) {
beanManager.fireEvent(new LoggedInEvent(user));
return RESPONSE_LOGIN_SUCCESS;
}
beanManager.fireEvent(new AlreadyLoggedInEvent());
return RESPONSE_LOGIN_SUCCESS;
}
boolean success = authenticate();
if (success) {
if (log.isDebugEnabled()) {
log.debug("Login successful");
}
beanManager.fireEvent(new LoggedInEvent(user));
return RESPONSE_LOGIN_SUCCESS;
}
beanManager.fireEvent(new LoginFailedEvent(null));
return RESPONSE_LOGIN_FAILED;