diff --git a/connections/jpa-liquibase/src/main/resources/META-INF/jpa-changelog-1.3.0.Beta1.xml b/connections/jpa-liquibase/src/main/resources/META-INF/jpa-changelog-1.3.0.Beta1.xml index 9f880e5087..864676a031 100755 --- a/connections/jpa-liquibase/src/main/resources/META-INF/jpa-changelog-1.3.0.Beta1.xml +++ b/connections/jpa-liquibase/src/main/resources/META-INF/jpa-changelog-1.3.0.Beta1.xml @@ -112,7 +112,17 @@ + + + + + + + UPDATE_PROFILE_FIRST_LOGIN = false + + + diff --git a/core/src/main/java/org/keycloak/representations/idm/IdentityProviderRepresentation.java b/core/src/main/java/org/keycloak/representations/idm/IdentityProviderRepresentation.java index 8d9a14e6a4..1e74002bc8 100755 --- a/core/src/main/java/org/keycloak/representations/idm/IdentityProviderRepresentation.java +++ b/core/src/main/java/org/keycloak/representations/idm/IdentityProviderRepresentation.java @@ -29,7 +29,25 @@ public class IdentityProviderRepresentation { protected String internalId; protected String providerId; protected boolean enabled = true; - protected boolean updateProfileFirstLogin = true; + + public static final String UPFLM_ON = "on"; + public static final String UPFLM_MISSING = "missing"; + public static final String UPFLM_OFF = "off"; + + /** + * Mode of profile update after first login when user is created over this identity provider. Possible values: + *
    + *
  • on - update profile page is presented for all users + *
  • missing - update profile page is presented for users with missing some of mandatory user profile fields + *
  • off - update profile page is newer shown after first login + *
+ * + * @see #UPFLM_ON + * @see #UPFLM_MISSING + * @see #UPFLM_OFF + */ + protected String updateProfileFirstLoginMode = UPFLM_ON; + protected boolean trustEmail; protected boolean storeToken; protected boolean addReadTokenRoleOnCreate; @@ -76,12 +94,29 @@ public class IdentityProviderRepresentation { this.enabled = enabled; } - public boolean isUpdateProfileFirstLogin() { - return this.updateProfileFirstLogin; + /** + * + * Deprecated because replaced by {@link #updateProfileFirstLoginMode}. Kept here to allow import of old realms. + * + * @deprecated {@link #setUpdateProfileFirstLoginMode(String)} + */ + @Deprecated + public void setUpdateProfileFirstLogin(boolean updateProfileFirstLogin) { + this.updateProfileFirstLoginMode = updateProfileFirstLogin ? UPFLM_ON : UPFLM_OFF; } - public void setUpdateProfileFirstLogin(boolean updateProfileFirstLogin) { - this.updateProfileFirstLogin = updateProfileFirstLogin; + /** + * @return see {@link #updateProfileFirstLoginMode} + */ + public String getUpdateProfileFirstLoginMode() { + return updateProfileFirstLoginMode; + } + + /** + * @param updateProfileFirstLoginMode see {@link #updateProfileFirstLoginMode} + */ + public void setUpdateProfileFirstLoginMode(String updateProfileFirstLoginMode) { + this.updateProfileFirstLoginMode = updateProfileFirstLoginMode; } public boolean isAuthenticateByDefault() { diff --git a/docbook/reference/en/en-US/modules/identity-broker.xml b/docbook/reference/en/en-US/modules/identity-broker.xml index 11460ea386..75df2c7572 100755 --- a/docbook/reference/en/en-US/modules/identity-broker.xml +++ b/docbook/reference/en/en-US/modules/identity-broker.xml @@ -299,9 +299,11 @@ Allows you to force users to update their profile right after the authentication finishes and - before the account is actually created in Keycloak. When enabled, users will be presented with the + before the account is actually created in Keycloak. When "On", users will be always presented with the update profile page asking for additional information in order to federate their identities. - If disabled, the account will be created with the minimal information obtained from the identity provider + When "On missing info", users will be presented with the update profile page only if some + mandatory information (email, first name, last name) is not provided by identity provider. + If "Off", the account will be created with the minimal information obtained from the identity provider during the authentication process. diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js index f60e20e65f..53ad7ae531 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/js/controllers/realm.js @@ -597,7 +597,7 @@ module.controller('RealmIdentityProviderCtrl', function($scope, $filter, $upload if (instance && instance.alias) { } else { - $scope.identityProvider.updateProfileFirstLogin = false; + $scope.identityProvider.updateProfileFirstLoginMode = "on"; } }; @@ -645,7 +645,7 @@ module.controller('RealmIdentityProviderCtrl', function($scope, $filter, $upload } else { $scope.identityProvider.config.nameIDPolicyFormat = $scope.nameIdFormats[0].format; - $scope.identityProvider.updateProfileFirstLogin = false; + $scope.identityProvider.updateProfileFirstLoginMode = "off"; } } @@ -663,7 +663,7 @@ module.controller('RealmIdentityProviderCtrl', function($scope, $filter, $upload $scope.identityProvider.alias = providerFactory.id; $scope.identityProvider.providerId = providerFactory.id; $scope.identityProvider.enabled = true; - $scope.identityProvider.updateProfileFirstLogin = false; + $scope.identityProvider.updateProfileFirstLoginMode = "off"; $scope.identityProvider.authenticateByDefault = false; $scope.newIdentityProvider = true; } diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-oidc.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-oidc.html index 40c0cab3ea..d2a267bfad 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-oidc.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-oidc.html @@ -59,11 +59,17 @@ Enable/disable new users can read any stored tokens. This assigns the broker.read-token role.
- -
- + +
+
+ +
- Indicates if user must update his profile right after the first login. + Define under which conditions must user update his profile right after the first login.
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-saml.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-saml.html index 1588151663..d2aaf4e137 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-saml.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-saml.html @@ -60,11 +60,17 @@ Enable/disable new users can read any stored tokens. This assigns the broker.read-token role.
- -
- + +
+
+ +
- Indicates if user must update his profile right after the first login. + Define under which conditions must user update his profile right after the first login.
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-social.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-social.html index 246677270e..623bcf0432 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-social.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-social.html @@ -70,11 +70,17 @@ Enable/disable this identity provider.
- -
- + +
+
+ +
- Indicates if user must update his profile right after the first login. + Define under which conditions must user update his profile right after the first login.
diff --git a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider.html b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider.html index c826a16eea..9a2a28f74c 100755 --- a/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider.html +++ b/forms/common-themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider.html @@ -8,7 +8,7 @@ Table of identity providers - +