Merge pull request #1506 from patriot1burke/master

timeout message
This commit is contained in:
Bill Burke 2015-07-25 15:27:51 -04:00
commit 652b118634
6 changed files with 19 additions and 12 deletions

View file

@ -26,6 +26,7 @@ loginOauthTitle=
loginOauthTitleHtml=Tempor\u00E4rer zugriff auf <strong>{0}</strong> angefordert von <strong>{1}</strong>.
loginTotpTitle=Mobile Authentifizierung Einrichten
loginProfileTitle=Benutzerkonto Informationen aktualisieren
loginTimeout=You took too long to login. Login process starting from beginning.
impersonateTitle={0} Impersonate User
impersonateTitleHtml=<strong>{0}</strong> Impersonate User</strong>
unknownUser=Unknown user

View file

@ -24,6 +24,7 @@ realmChoice=Realm
unknownUser=Unknown user
loginTotpTitle=Mobile Authenticator Setup
loginProfileTitle=Update Account Information
loginTimeout=You took too long to login. Login process starting from beginning.
oauthGrantTitle=OAuth Grant
oauthGrantTitleHtml=Temporary access for <strong>{0}</strong> requested by
errorTitle=We''re sorry...

View file

@ -24,6 +24,7 @@ loginTitle=Accedi a {0}
loginTitleHtml=Accedi a <strong>{0}</strong>
loginTotpTitle=Configura Autenticazione Mobile
loginProfileTitle=Aggiorna Profilo
loginTimeout=You took too long to login. Login process starting from beginning.
impersonateTitle={0} Impersonate User
impersonateTitleHtml=<strong>{0}</strong> Impersonate User</strong>
unknownUser=Unknown user

View file

@ -22,6 +22,7 @@ registerWithTitle=Registre-se com {0}
registerWithTitleHtml=Registre-se com <strong>{0}</strong>
loginTitle=Entrar em {0}
loginTitleHtml=Entrar em <strong>{0}</strong>
loginTimeout=You took too long to login. Login process starting from beginning.
impersonateTitle={0} Impersonate User
impersonateTitleHtml=<strong>{0}</strong> Impersonate User</strong>
unknownUser=Unknown user

View file

@ -26,6 +26,8 @@ package org.keycloak.services.messages;
*/
public class Messages {
public static final String LOGIN_TIMEOUT = "loginTimeout";
public static final String INVALID_USER = "invalidUserMessage";
public static final String INVALID_EMAIL = "invalidEmailMessage";

View file

@ -164,7 +164,7 @@ public class LoginActionsService {
event.clone().error(Errors.EXPIRED_CODE);
if (clientCode.getClientSession().getAction().equals(ClientSessionModel.Action.AUTHENTICATE.name())) {
AuthenticationProcessor.resetFlow(clientCode.getClientSession());
response = processAuthentication(null, clientCode.getClientSession());
response = processAuthentication(null, clientCode.getClientSession(), Messages.LOGIN_TIMEOUT);
return false;
}
response = ErrorPage.error(session, Messages.EXPIRED_CODE);
@ -187,7 +187,7 @@ public class LoginActionsService {
event.clone().error(Errors.EXPIRED_CODE);
if (clientCode.getClientSession().getAction().equals(ClientSessionModel.Action.AUTHENTICATE.name())) {
AuthenticationProcessor.resetFlow(clientCode.getClientSession());
response = processAuthentication(null, clientCode.getClientSession());
response = processAuthentication(null, clientCode.getClientSession(), Messages.LOGIN_TIMEOUT);
} else {
if (clientCode.getClientSession().getUserSession() == null) {
session.sessions().removeClientSession(realm, clientCode.getClientSession());
@ -219,7 +219,7 @@ public class LoginActionsService {
ClientSessionModel clientSession = RestartLoginCookie.restartSession(session, realm, code);
if (clientSession != null) {
event.clone().detail(Details.RESTART_AFTER_TIMEOUT, "true").error(Errors.EXPIRED_CODE);
response = processFlow(null, clientSession, flow);
response = processFlow(null, clientSession, flow, Messages.LOGIN_TIMEOUT);
return false;
}
} catch (Exception e) {
@ -279,15 +279,15 @@ public class LoginActionsService {
clientSession.setAction(ClientSessionModel.Action.AUTHENTICATE.name());
}
return processAuthentication(execution, clientSession);
return processAuthentication(execution, clientSession, null);
}
protected Response processAuthentication(String execution, ClientSessionModel clientSession) {
protected Response processAuthentication(String execution, ClientSessionModel clientSession, String errorMessage) {
String flowAlias = DefaultAuthenticationFlows.BROWSER_FLOW;
return processFlow(execution, clientSession, flowAlias);
return processFlow(execution, clientSession, flowAlias, errorMessage);
}
protected Response processFlow(String execution, ClientSessionModel clientSession, String flowAlias) {
protected Response processFlow(String execution, ClientSessionModel clientSession, String flowAlias, String errorMessage) {
AuthenticationFlowModel flow = realm.getFlowByAlias(flowAlias);
AuthenticationProcessor processor = new AuthenticationProcessor();
processor.setClientSession(clientSession)
@ -295,6 +295,7 @@ public class LoginActionsService {
.setConnection(clientConnection)
.setEventBuilder(event)
.setProtector(authManager.getProtector())
.setForwardedErrorMessage(errorMessage)
.setRealm(realm)
.setSession(session)
.setUriInfo(uriInfo)
@ -329,12 +330,12 @@ public class LoginActionsService {
final ClientSessionCode clientCode = checks.clientCode;
final ClientSessionModel clientSession = clientCode.getClientSession();
return processAuthentication(execution, clientSession);
return processAuthentication(execution, clientSession, null);
}
protected Response processRegistration(String execution, ClientSessionModel clientSession) {
protected Response processRegistration(String execution, ClientSessionModel clientSession, String errorMessage) {
String flowAlias = DefaultAuthenticationFlows.REGISTRATION_FLOW;
return processFlow(execution, clientSession, flowAlias);
return processFlow(execution, clientSession, flowAlias, errorMessage);
}
@ -365,7 +366,7 @@ public class LoginActionsService {
authManager.expireIdentityCookie(realm, uriInfo, clientConnection);
return processRegistration(execution, clientSession);
return processRegistration(execution, clientSession, null);
}
@ -392,7 +393,7 @@ public class LoginActionsService {
ClientSessionCode clientCode = checks.clientCode;
ClientSessionModel clientSession = clientCode.getClientSession();
return processRegistration(execution, clientSession);
return processRegistration(execution, clientSession, null);
}
/**