diff --git a/server-spi/src/main/java/org/keycloak/forms/login/LoginFormsProvider.java b/server-spi/src/main/java/org/keycloak/forms/login/LoginFormsProvider.java index a89bfc187f..88b309e960 100755 --- a/server-spi/src/main/java/org/keycloak/forms/login/LoginFormsProvider.java +++ b/server-spi/src/main/java/org/keycloak/forms/login/LoginFormsProvider.java @@ -109,6 +109,8 @@ public interface LoginFormsProvider extends Provider { public LoginFormsProvider setSuccess(String message, Object ... parameters); + public LoginFormsProvider setInfo(String message, Object ... parameters); + public LoginFormsProvider setUser(UserModel user); public LoginFormsProvider setResponseHeader(String headerName, String headerValue); diff --git a/services/src/main/java/org/keycloak/authentication/authenticators/broker/IdpUsernamePasswordForm.java b/services/src/main/java/org/keycloak/authentication/authenticators/broker/IdpUsernamePasswordForm.java index 7bcf018a6b..5b0e1523b3 100755 --- a/services/src/main/java/org/keycloak/authentication/authenticators/broker/IdpUsernamePasswordForm.java +++ b/services/src/main/java/org/keycloak/authentication/authenticators/broker/IdpUsernamePasswordForm.java @@ -67,6 +67,6 @@ public class IdpUsernamePasswordForm extends UsernamePasswordForm { return context.form() .setFormData(formData) .setAttribute(LoginFormsProvider.USERNAME_EDIT_DISABLED, true) - .setSuccess(Messages.FEDERATED_IDENTITY_CONFIRM_REAUTHENTICATE_MESSAGE, existingUser.getUsername(), serializedCtx.getIdentityProviderId()); + .setInfo(Messages.FEDERATED_IDENTITY_CONFIRM_REAUTHENTICATE_MESSAGE, existingUser.getUsername(), serializedCtx.getIdentityProviderId()); } } diff --git a/services/src/main/java/org/keycloak/forms/login/freemarker/FreeMarkerLoginFormsProvider.java b/services/src/main/java/org/keycloak/forms/login/freemarker/FreeMarkerLoginFormsProvider.java index bbbbc23b69..bb2e518d9c 100755 --- a/services/src/main/java/org/keycloak/forms/login/freemarker/FreeMarkerLoginFormsProvider.java +++ b/services/src/main/java/org/keycloak/forms/login/freemarker/FreeMarkerLoginFormsProvider.java @@ -569,6 +569,12 @@ public class FreeMarkerLoginFormsProvider implements LoginFormsProvider { return this; } + @Override + public FreeMarkerLoginFormsProvider setInfo(String message, Object... parameters) { + setMessage(MessageType.INFO, message, parameters); + return this; + } + @Override public FreeMarkerLoginFormsProvider setUser(UserModel user) { this.user = user; diff --git a/services/src/main/java/org/keycloak/theme/beans/MessageType.java b/services/src/main/java/org/keycloak/theme/beans/MessageType.java index 375119b0fb..da37816620 100755 --- a/services/src/main/java/org/keycloak/theme/beans/MessageType.java +++ b/services/src/main/java/org/keycloak/theme/beans/MessageType.java @@ -23,6 +23,6 @@ package org.keycloak.theme.beans; */ public enum MessageType { - SUCCESS, WARNING, ERROR + SUCCESS, WARNING, INFO, ERROR } diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/AbstractFirstBrokerLoginTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/AbstractFirstBrokerLoginTest.java index 70ec57f527..3b1b440920 100755 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/AbstractFirstBrokerLoginTest.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/AbstractFirstBrokerLoginTest.java @@ -321,7 +321,7 @@ public abstract class AbstractFirstBrokerLoginTest extends AbstractIdentityProvi Assert.assertEquals("pedroigor", this.loginPage.getUsername()); Assert.assertFalse(this.loginPage.isUsernameInputEnabled()); - Assert.assertEquals("Authenticate as pedroigor to link your account with " + getProviderId(), this.loginPage.getSuccessMessage()); + Assert.assertEquals("Authenticate as pedroigor to link your account with " + getProviderId(), this.loginPage.getInfoMessage()); try { this.loginPage.findSocialButton(getProviderId()); diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/OIDCFirstBrokerLoginTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/OIDCFirstBrokerLoginTest.java index 62b5c92e59..3a3df528b9 100644 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/OIDCFirstBrokerLoginTest.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/OIDCFirstBrokerLoginTest.java @@ -116,7 +116,7 @@ public class OIDCFirstBrokerLoginTest extends AbstractFirstBrokerLoginTest { // assert reauthentication with login page. On login page is link to kc-saml-idp-basic as user has it linked already Assert.assertEquals("Log in to " + APP_REALM_ID, this.driver.getTitle()); - Assert.assertEquals("Authenticate as pedroigor to link your account with " + getProviderId(), this.loginPage.getSuccessMessage()); + Assert.assertEquals("Authenticate as pedroigor to link your account with " + getProviderId(), this.loginPage.getInfoMessage()); try { this.loginPage.findSocialButton(getProviderId()); diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/PostBrokerFlowTest.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/PostBrokerFlowTest.java index 6081206bf5..d5fe80d7f5 100644 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/PostBrokerFlowTest.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/broker/PostBrokerFlowTest.java @@ -265,7 +265,7 @@ public class PostBrokerFlowTest extends AbstractIdentityProviderTest { // assert reauthentication with login page. On login page is link to kc-saml-idp-basic as user has it linked already Assert.assertEquals("Log in to " + APP_REALM_ID, this.driver.getTitle()); - Assert.assertEquals("Authenticate as test-user to link your account with " + getProviderId(), this.loginPage.getSuccessMessage()); + Assert.assertEquals("Authenticate as test-user to link your account with " + getProviderId(), this.loginPage.getInfoMessage()); // reauthenticate with SAML broker. OTP authentication is required as well this.loginPage.clickSocial("kc-saml-idp-basic"); diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/IdpConfirmLinkPage.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/IdpConfirmLinkPage.java index d246597256..db64eff072 100644 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/IdpConfirmLinkPage.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/IdpConfirmLinkPage.java @@ -31,7 +31,7 @@ public class IdpConfirmLinkPage extends AbstractPage { @FindBy(id = "linkAccount") private WebElement linkAccountButton; - @FindBy(className = "instruction") + @FindBy(className = "alert-error") private WebElement message; @Override diff --git a/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/LoginPage.java b/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/LoginPage.java index 301bbe6b1e..4b3ecb4aa4 100755 --- a/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/LoginPage.java +++ b/testsuite/integration/src/test/java/org/keycloak/testsuite/pages/LoginPage.java @@ -64,7 +64,11 @@ public class LoginPage extends AbstractPage { private WebElement loginWarningMessage; @FindBy(className = "alert-success") - private WebElement emailSuccessMessage; + private WebElement loginSuccessMessage; + + + @FindBy(className = "alert-info") + private WebElement loginInfoMessage; @FindBy(id = "kc-current-locale-link") @@ -124,7 +128,10 @@ public class LoginPage extends AbstractPage { } public String getSuccessMessage() { - return emailSuccessMessage != null ? emailSuccessMessage.getText() : null; + return loginSuccessMessage != null ? loginSuccessMessage.getText() : null; + } + public String getInfoMessage() { + return loginInfoMessage != null ? loginInfoMessage.getText() : null; } diff --git a/themes/src/main/resources/theme/base/login/login-idp-link-confirm.ftl b/themes/src/main/resources/theme/base/login/login-idp-link-confirm.ftl index f77eb38bfa..29ee2ae97f 100644 --- a/themes/src/main/resources/theme/base/login/login-idp-link-confirm.ftl +++ b/themes/src/main/resources/theme/base/login/login-idp-link-confirm.ftl @@ -1,21 +1,13 @@ <#import "template.ftl" as layout> -<@layout.registrationLayout displayMessage=false; section> +<@layout.registrationLayout; section> <#if section = "title"> ${msg("confirmLinkIdpTitle")} <#elseif section = "header"> ${msg("confirmLinkIdpTitle")} <#elseif section = "form"> -
${message.summary}
-