testsuite/integration/src/test/java/org/keycloak/testsuite/broker/AbstractIdentityProviderTest.java
/**
     * Test for KEYCLOAK-1372 - verify email action is performed if email is provided and email trust is enabled for the provider, but email is changed on First login update profile page
     * 
     * @throws MessagingException
     * @throws IOException
     */
Test for KEYCLOAK-1372 - verify email action is performed if email is provided and email trust is enabled for the provider, but email is changed on First login update profile page


Test for KEYCLOAK - 1372 - verify email action is performed if email is provided and email trust is enabled for the provider but email is changed on First login update profile page
@Test
    public void testSuccessfulAuthentication_emailTrustEnabled_emailVerifyEnabled_emailUpdatedOnFirstLogin() throws IOException, MessagingException {
        getRealm().setVerifyEmail(true);
        brokerServerRule.stopSession(this.session, true);
        this.session = brokerServerRule.startSession();
        IdentityProviderModel identityProviderModel = getIdentityProviderModel();
        try {
            identityProviderModel.setUpdateProfileFirstLoginMode(IdentityProviderRepresentation.UPFLM_ON);
            identityProviderModel.setTrustEmail(true);
            UserModel user = assertSuccessfulAuthenticationWithEmailVerification(identityProviderModel, "test-user", "new@email.com", true);
            Assert.assertEquals("617-666-7777", user.getAttribute("mobile"));
        } finally {
            identityProviderModel.setTrustEmail(false);
            getRealm().setVerifyEmail(false);
        }
    }
@ Test public void testSuccessfulAuthentication_emailTrustEnabled_emailVerifyEnabled_emailUpdatedOnFirstLogin ( ) throws IOException , MessagingException { getRealm ( ) . setVerifyEmail ( true ) ; brokerServerRule . stopSession ( this . session , true ) ; this . session = brokerServerRule . startSession ( ) ; IdentityProviderModel identityProviderModel = getIdentityProviderModel ( ) ; try { identityProviderModel . setUpdateProfileFirstLoginMode ( IdentityProviderRepresentation . UPFLM_ON ) ; identityProviderModel . setTrustEmail ( true ) ; UserModel user = assertSuccessfulAuthenticationWithEmailVerification ( identityProviderModel , "test-user" , "new@email.com" , true ) ; Assert . assertEquals ( "617-666-7777" , user . getAttribute ( "mobile" ) ) ; } finally { identityProviderModel . setTrustEmail ( false ) ; getRealm ( ) . setVerifyEmail ( false ) ; } }
Test for KEYCLOAK-1372 - verify email action is performed if email is provided and email trust is enabled for the provider, but email is changed on First login update profile page
Test for KEYCLOAK - 1372 - verify email action is performed if email is provided and email trust is enabled for the provider but email is changed on First login update profile page