diff --git a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_de.properties b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_de.properties index 2a9666185b..23556478d4 100755 --- a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_de.properties +++ b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_de.properties @@ -26,6 +26,7 @@ loginOauthTitle= loginOauthTitleHtml=Tempor\u00E4rer zugriff auf {0} angefordert von {1}. 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={0} Impersonate User unknownUser=Unknown user diff --git a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_en.properties b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_en.properties index a9183dc605..387b5bebda 100755 --- a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_en.properties +++ b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_en.properties @@ -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 {0} requested by errorTitle=We''re sorry... diff --git a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_it.properties b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_it.properties index fc630ad4fa..739526a612 100755 --- a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_it.properties +++ b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_it.properties @@ -24,6 +24,7 @@ loginTitle=Accedi a {0} loginTitleHtml=Accedi a {0} loginTotpTitle=Configura Autenticazione Mobile loginProfileTitle=Aggiorna Profilo +loginTimeout=You took too long to login. Login process starting from beginning. impersonateTitle={0} Impersonate User impersonateTitleHtml={0} Impersonate User unknownUser=Unknown user diff --git a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_pt_BR.properties b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_pt_BR.properties index a0f34ab39d..77f5f04c0b 100755 --- a/forms/common-themes/src/main/resources/theme/base/login/messages/messages_pt_BR.properties +++ b/forms/common-themes/src/main/resources/theme/base/login/messages/messages_pt_BR.properties @@ -22,6 +22,7 @@ registerWithTitle=Registre-se com {0} registerWithTitleHtml=Registre-se com {0} loginTitle=Entrar em {0} loginTitleHtml=Entrar em {0} +loginTimeout=You took too long to login. Login process starting from beginning. impersonateTitle={0} Impersonate User impersonateTitleHtml={0} Impersonate User unknownUser=Unknown user diff --git a/services/src/main/java/org/keycloak/services/messages/Messages.java b/services/src/main/java/org/keycloak/services/messages/Messages.java index 6b00346513..80914db040 100755 --- a/services/src/main/java/org/keycloak/services/messages/Messages.java +++ b/services/src/main/java/org/keycloak/services/messages/Messages.java @@ -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"; diff --git a/services/src/main/java/org/keycloak/services/resources/LoginActionsService.java b/services/src/main/java/org/keycloak/services/resources/LoginActionsService.java index 21f481b897..14f81d04a6 100755 --- a/services/src/main/java/org/keycloak/services/resources/LoginActionsService.java +++ b/services/src/main/java/org/keycloak/services/resources/LoginActionsService.java @@ -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); } /**