diff --git a/model/jpa/src/main/java/org/keycloak/models/jpa/RealmAdapter.java b/model/jpa/src/main/java/org/keycloak/models/jpa/RealmAdapter.java index 17f9f86314..930158c6de 100755 --- a/model/jpa/src/main/java/org/keycloak/models/jpa/RealmAdapter.java +++ b/model/jpa/src/main/java/org/keycloak/models/jpa/RealmAdapter.java @@ -22,7 +22,6 @@ import org.keycloak.common.enums.SslRequired; import org.keycloak.common.util.MultivaluedHashMap; import org.keycloak.component.ComponentFactory; import org.keycloak.component.ComponentModel; -import org.keycloak.jose.jwk.JWKBuilder; import org.keycloak.models.AuthenticationExecutionModel; import org.keycloak.models.AuthenticationFlowModel; import org.keycloak.models.AuthenticatorConfigModel; @@ -66,10 +65,6 @@ import org.keycloak.models.utils.KeycloakModelUtils; import javax.persistence.EntityManager; import javax.persistence.TypedQuery; -import java.security.Key; -import java.security.PrivateKey; -import java.security.PublicKey; -import java.security.cert.X509Certificate; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -2058,6 +2053,8 @@ public class RealmAdapter implements RealmModel, JpaModel { em.persist(c); setConfig(model, c); model.setId(c.getId()); + KeycloakModelUtils.notifyCreated(session, this, model); + return model; } diff --git a/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/RealmAdapter.java b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/RealmAdapter.java index 23ab0a9b58..a17e020c10 100755 --- a/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/RealmAdapter.java +++ b/model/mongo/src/main/java/org/keycloak/models/mongo/keycloak/adapters/RealmAdapter.java @@ -1966,7 +1966,7 @@ public class RealmAdapter extends AbstractMongoAdapter impleme model.setId(entity.getId()); realm.getComponentEntities().add(entity); updateRealm(); - + KeycloakModelUtils.notifyCreated(session, this, model); return model; } diff --git a/server-spi/src/main/java/org/keycloak/component/ComponentFactory.java b/server-spi/src/main/java/org/keycloak/component/ComponentFactory.java index a0603dbb81..cda4a342c8 100644 --- a/server-spi/src/main/java/org/keycloak/component/ComponentFactory.java +++ b/server-spi/src/main/java/org/keycloak/component/ComponentFactory.java @@ -17,6 +17,7 @@ package org.keycloak.component; import org.keycloak.models.KeycloakSession; +import org.keycloak.models.RealmModel; import org.keycloak.provider.ConfiguredProvider; import org.keycloak.provider.Provider; import org.keycloak.provider.ProviderFactory; @@ -35,4 +36,9 @@ public interface ComponentFactory ex void validateConfiguration(KeycloakSession session, ComponentModel model) throws ComponentValidationException; + default + void onCreate(KeycloakSession session, RealmModel realm, ComponentModel model) { + + } + } diff --git a/server-spi/src/main/java/org/keycloak/models/utils/KeycloakModelUtils.java b/server-spi/src/main/java/org/keycloak/models/utils/KeycloakModelUtils.java index 230d15f137..1263dc893e 100755 --- a/server-spi/src/main/java/org/keycloak/models/utils/KeycloakModelUtils.java +++ b/server-spi/src/main/java/org/keycloak/models/utils/KeycloakModelUtils.java @@ -24,6 +24,7 @@ import org.keycloak.common.util.CertificateUtils; import org.keycloak.common.util.KeyUtils; import org.keycloak.common.util.MultivaluedHashMap; import org.keycloak.common.util.PemUtils; +import org.keycloak.component.ComponentFactory; import org.keycloak.component.ComponentModel; import org.keycloak.keys.KeyProvider; import org.keycloak.models.AuthenticationExecutionModel; @@ -48,6 +49,8 @@ import org.keycloak.models.UserFederationProvider; import org.keycloak.models.UserFederationProviderFactory; import org.keycloak.models.UserFederationProviderModel; import org.keycloak.models.UserModel; +import org.keycloak.provider.Provider; +import org.keycloak.provider.ProviderFactory; import org.keycloak.representations.idm.CertificateRepresentation; import org.keycloak.transaction.JtaTransactionManagerLookup; @@ -680,4 +683,16 @@ public final class KeycloakModelUtils { } + public static void notifyCreated(KeycloakSession session, RealmModel realm, ComponentModel model) { + Class providerClass = null; + try { + providerClass = (Class)Class.forName(model.getProviderType()); + } catch (ClassNotFoundException e) { + throw new RuntimeException(e); + } + ProviderFactory factory = session.getKeycloakSessionFactory().getProviderFactory(providerClass, model.getProviderId()); + if (factory instanceof ComponentFactory) { + ((ComponentFactory)factory).onCreate(session, realm, model); + } + } } diff --git a/server-spi/src/main/java/org/keycloak/storage/UserStorageProviderFactory.java b/server-spi/src/main/java/org/keycloak/storage/UserStorageProviderFactory.java index 5102355982..dd4df811c2 100755 --- a/server-spi/src/main/java/org/keycloak/storage/UserStorageProviderFactory.java +++ b/server-spi/src/main/java/org/keycloak/storage/UserStorageProviderFactory.java @@ -23,6 +23,7 @@ import org.keycloak.component.ComponentModel; import org.keycloak.component.ComponentValidationException; import org.keycloak.models.KeycloakSession; import org.keycloak.models.KeycloakSessionFactory; +import org.keycloak.models.RealmModel; import org.keycloak.provider.ProviderConfigProperty; import java.util.Collections; @@ -82,4 +83,16 @@ public interface UserStorageProviderFactory exten } + /** + * Called when UserStorageProviderModel is created. This allows you to do initialization of any additional configuration + * you need to add. For example, you may be introspecting a database or ldap schema to automatically create mappings. + * + * @param session + * @param realm + * @param model + */ + @Override + default void onCreate(KeycloakSession session, RealmModel realm, ComponentModel model) { + + } } diff --git a/services/src/main/java/org/keycloak/broker/oidc/OIDCIdentityProvider.java b/services/src/main/java/org/keycloak/broker/oidc/OIDCIdentityProvider.java index 8f971b8284..19b6dc2b4c 100755 --- a/services/src/main/java/org/keycloak/broker/oidc/OIDCIdentityProvider.java +++ b/services/src/main/java/org/keycloak/broker/oidc/OIDCIdentityProvider.java @@ -243,16 +243,19 @@ public class OIDCIdentityProvider extends AbstractOAuth2IdentityProvider + +
+ +
+ {{:: 'identity-provider.google-userIp.tooltip' | translate}} + \ No newline at end of file diff --git a/themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-social.html b/themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-social.html index 2c51dd52a6..d5c0d85221 100755 --- a/themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-social.html +++ b/themes/src/main/resources/theme/base/admin/resources/partials/realm-identity-provider-social.html @@ -64,6 +64,13 @@ {{:: 'identity-provider.enabled.tooltip' | translate}} +
+ +
+ +
+ {{:: 'identity-provider.disableUserInfo.tooltip' | translate}} +