From 03c05bd72b607eca8809d41abdb3b1bcf6782b17 Mon Sep 17 00:00:00 2001 From: mposolda Date: Mon, 5 Sep 2016 18:04:24 +0200 Subject: [PATCH] KEYCLOAK-2957 IdpEmailVerificationAuthenticator should setEmailVerified to true after successfuly link user by email verification --- .../broker/IdpEmailVerificationAuthenticator.java | 3 +++ .../testsuite/broker/AbstractFirstBrokerLoginTest.java | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/services/src/main/java/org/keycloak/authentication/authenticators/broker/IdpEmailVerificationAuthenticator.java b/services/src/main/java/org/keycloak/authentication/authenticators/broker/IdpEmailVerificationAuthenticator.java index 620e0c9f87..e56e7e6e31 100755 --- a/services/src/main/java/org/keycloak/authentication/authenticators/broker/IdpEmailVerificationAuthenticator.java +++ b/services/src/main/java/org/keycloak/authentication/authenticators/broker/IdpEmailVerificationAuthenticator.java @@ -132,6 +132,9 @@ public class IdpEmailVerificationAuthenticator extends AbstractIdpAuthenticator clientSession.setNote(IS_DIFFERENT_BROWSER, "true"); } + // User successfully confirmed linking by email verification. His email was defacto verified + existingUser.setEmailVerified(true); + context.setUser(existingUser); context.success(); } else { 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 3b1b440920..67b82bb046 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 @@ -287,6 +287,10 @@ public abstract class AbstractFirstBrokerLoginTest extends AbstractIdentityProvi // authenticated and redirected to app. User is linked with identity provider assertFederatedUser("pedroigor", "psilva@redhat.com", "pedroigor"); + + // Assert user's email is verified now + UserModel user = getFederatedUser(); + Assert.assertTrue(user.isEmailVerified()); }