error handling
This commit is contained in:
parent
dc0d9a8dce
commit
dcc40b0a63
2 changed files with 5 additions and 19 deletions
|
@ -333,7 +333,7 @@ public class AuthenticationProcessor {
|
|||
}
|
||||
|
||||
public Response authenticate() throws AuthException {
|
||||
logger.info("AUTHENTICATE");
|
||||
logger.debug("AUTHENTICATE");
|
||||
event.event(EventType.LOGIN);
|
||||
event.client(clientSession.getClient().getClientId())
|
||||
.detail(Details.REDIRECT_URI, clientSession.getRedirectUri())
|
||||
|
|
|
@ -357,31 +357,17 @@ public class LoginActionsService {
|
|||
logger.error("failed authentication: " + e.getError().toString(), e);
|
||||
if (e.getError() == AuthenticationProcessor.Error.INVALID_USER) {
|
||||
event.error(Errors.USER_NOT_FOUND);
|
||||
return session.getProvider(LoginFormsProvider.class)
|
||||
.setError(Messages.INVALID_USER)
|
||||
.setClientSessionCode(code)
|
||||
.createLogin();
|
||||
|
||||
return ErrorPage.error(session, Messages.INVALID_USER);
|
||||
} else if (e.getError() == AuthenticationProcessor.Error.USER_DISABLED) {
|
||||
event.error(Errors.USER_DISABLED);
|
||||
return session.getProvider(LoginFormsProvider.class)
|
||||
.setError(Messages.ACCOUNT_DISABLED)
|
||||
.setClientSessionCode(code)
|
||||
.createLogin();
|
||||
|
||||
return ErrorPage.error(session, Messages.ACCOUNT_DISABLED);
|
||||
} else if (e.getError() == AuthenticationProcessor.Error.USER_TEMPORARILY_DISABLED) {
|
||||
event.error(Errors.USER_TEMPORARILY_DISABLED);
|
||||
return session.getProvider(LoginFormsProvider.class)
|
||||
.setError(Messages.ACCOUNT_TEMPORARILY_DISABLED)
|
||||
.setClientSessionCode(code)
|
||||
.createLogin();
|
||||
return ErrorPage.error(session, Messages.ACCOUNT_TEMPORARILY_DISABLED);
|
||||
|
||||
} else {
|
||||
event.error(Errors.INVALID_USER_CREDENTIALS);
|
||||
return session.getProvider(LoginFormsProvider.class)
|
||||
.setError(Messages.INVALID_USER)
|
||||
.setClientSessionCode(code)
|
||||
.createLogin();
|
||||
return ErrorPage.error(session, Messages.INVALID_USER);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue