Class AbstractUserProfileProvider<U extends org.keycloak.userprofile.UserProfileProvider>

  • All Implemented Interfaces:
    org.keycloak.provider.Provider, org.keycloak.provider.ProviderFactory<U>, org.keycloak.userprofile.UserProfileProvider, org.keycloak.userprofile.UserProfileProviderFactory<U>
    Direct Known Subclasses:
    DeclarativeUserProfileProvider

    public abstract class AbstractUserProfileProvider<U extends org.keycloak.userprofile.UserProfileProvider>
    extends Object
    implements org.keycloak.userprofile.UserProfileProvider, org.keycloak.userprofile.UserProfileProviderFactory<U>

    A base class for UserProfileProvider implementations providing the main hooks for customizations.

    Author:
    Markus Till
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected Map<org.keycloak.userprofile.UserProfileContext,​org.keycloak.userprofile.UserProfileMetadata> contextualMetadataRegistry  
      protected org.keycloak.models.KeycloakSession session  
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractUserProfileProvider()  
      AbstractUserProfileProvider​(org.keycloak.models.KeycloakSession session, Map<org.keycloak.userprofile.UserProfileContext,​org.keycloak.userprofile.UserProfileMetadata> contextualMetadataRegistry)  
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      void close()  
      protected org.keycloak.userprofile.UserProfileMetadata configureUserProfile​(org.keycloak.userprofile.UserProfileMetadata metadata)
      Sub-types can override this method to customize how contextual profile metadata is configured at init time.
      protected org.keycloak.userprofile.UserProfileMetadata configureUserProfile​(org.keycloak.userprofile.UserProfileMetadata metadata, org.keycloak.models.KeycloakSession session)
      Sub-types can override this method to customize how contextual profile metadata is configured at runtime.
      U create​(org.keycloak.models.KeycloakSession session)  
      protected abstract U create​(org.keycloak.models.KeycloakSession session, Map<org.keycloak.userprofile.UserProfileContext,​org.keycloak.userprofile.UserProfileMetadata> metadataRegistry)
      Subclasses can override this method to create their instances of UserProfileProvider.
      org.keycloak.userprofile.UserProfile create​(org.keycloak.userprofile.UserProfileContext context, Map<String,​?> attributes)  
      org.keycloak.userprofile.UserProfile create​(org.keycloak.userprofile.UserProfileContext context, Map<String,​?> attributes, org.keycloak.models.UserModel user)  
      org.keycloak.userprofile.UserProfile create​(org.keycloak.userprofile.UserProfileContext context, org.keycloak.models.UserModel user)  
      protected org.keycloak.userprofile.Attributes createAttributes​(org.keycloak.userprofile.UserProfileContext context, Map<String,​?> attributes, org.keycloak.models.UserModel user, org.keycloak.userprofile.UserProfileMetadata metadata)  
      String getConfiguration()  
      static Pattern getRegexPatternString​(String[] builtinReadOnlyAttributes)  
      void init​(org.keycloak.Config.Scope config)  
      void postInit​(org.keycloak.models.KeycloakSessionFactory factory)  
      void setConfiguration​(String configuration)  
      • Methods inherited from interface org.keycloak.provider.ProviderFactory

        getConfigMetadata, getId, order
    • Field Detail

      • contextualMetadataRegistry

        protected final Map<org.keycloak.userprofile.UserProfileContext,​org.keycloak.userprofile.UserProfileMetadata> contextualMetadataRegistry
      • session

        protected final org.keycloak.models.KeycloakSession session
    • Constructor Detail

      • AbstractUserProfileProvider

        public AbstractUserProfileProvider()
      • AbstractUserProfileProvider

        public AbstractUserProfileProvider​(org.keycloak.models.KeycloakSession session,
                                           Map<org.keycloak.userprofile.UserProfileContext,​org.keycloak.userprofile.UserProfileMetadata> contextualMetadataRegistry)
    • Method Detail

      • getRegexPatternString

        public static Pattern getRegexPatternString​(String[] builtinReadOnlyAttributes)
      • create

        public org.keycloak.userprofile.UserProfile create​(org.keycloak.userprofile.UserProfileContext context,
                                                           org.keycloak.models.UserModel user)
        Specified by:
        create in interface org.keycloak.userprofile.UserProfileProvider
      • create

        public org.keycloak.userprofile.UserProfile create​(org.keycloak.userprofile.UserProfileContext context,
                                                           Map<String,​?> attributes,
                                                           org.keycloak.models.UserModel user)
        Specified by:
        create in interface org.keycloak.userprofile.UserProfileProvider
      • create

        public org.keycloak.userprofile.UserProfile create​(org.keycloak.userprofile.UserProfileContext context,
                                                           Map<String,​?> attributes)
        Specified by:
        create in interface org.keycloak.userprofile.UserProfileProvider
      • create

        public U create​(org.keycloak.models.KeycloakSession session)
        Specified by:
        create in interface org.keycloak.provider.ProviderFactory<U extends org.keycloak.userprofile.UserProfileProvider>
      • init

        public void init​(org.keycloak.Config.Scope config)
        Specified by:
        init in interface org.keycloak.provider.ProviderFactory<U extends org.keycloak.userprofile.UserProfileProvider>
      • postInit

        public void postInit​(org.keycloak.models.KeycloakSessionFactory factory)
        Specified by:
        postInit in interface org.keycloak.provider.ProviderFactory<U extends org.keycloak.userprofile.UserProfileProvider>
      • close

        public void close()
        Specified by:
        close in interface org.keycloak.provider.Provider
        Specified by:
        close in interface org.keycloak.provider.ProviderFactory<U extends org.keycloak.userprofile.UserProfileProvider>
      • getConfiguration

        public String getConfiguration()
        Specified by:
        getConfiguration in interface org.keycloak.userprofile.UserProfileProvider
      • setConfiguration

        public void setConfiguration​(String configuration)
        Specified by:
        setConfiguration in interface org.keycloak.userprofile.UserProfileProvider
      • create

        protected abstract U create​(org.keycloak.models.KeycloakSession session,
                                    Map<org.keycloak.userprofile.UserProfileContext,​org.keycloak.userprofile.UserProfileMetadata> metadataRegistry)
        Subclasses can override this method to create their instances of UserProfileProvider.
        Parameters:
        session - the session
        metadataRegistry - the profile metadata
        Returns:
        the profile provider instance
      • configureUserProfile

        protected org.keycloak.userprofile.UserProfileMetadata configureUserProfile​(org.keycloak.userprofile.UserProfileMetadata metadata)
        Sub-types can override this method to customize how contextual profile metadata is configured at init time.
        Parameters:
        metadata - the profile metadata
        Returns:
        the metadata
      • configureUserProfile

        protected org.keycloak.userprofile.UserProfileMetadata configureUserProfile​(org.keycloak.userprofile.UserProfileMetadata metadata,
                                                                                    org.keycloak.models.KeycloakSession session)
        Sub-types can override this method to customize how contextual profile metadata is configured at runtime.
        Parameters:
        metadata - the profile metadata
        session - the current session
        Returns:
        the metadata
      • createAttributes

        protected org.keycloak.userprofile.Attributes createAttributes​(org.keycloak.userprofile.UserProfileContext context,
                                                                       Map<String,​?> attributes,
                                                                       org.keycloak.models.UserModel user,
                                                                       org.keycloak.userprofile.UserProfileMetadata metadata)