Class DeclarativeUserProfileProvider

java.lang.Object
org.keycloak.userprofile.DeclarativeUserProfileProvider
All Implemented Interfaces:
org.keycloak.provider.Provider, org.keycloak.userprofile.UserProfileProvider

public class DeclarativeUserProfileProvider extends Object implements org.keycloak.userprofile.UserProfileProvider
UserProfileProvider loading configuration from the changeable JSON file stored in component config. Parsed configuration is cached.
Author:
Pedro Igor, Vlastimil Elias <velias@redhat.com>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final String
     
    protected static final String
     
    protected final org.keycloak.representations.userprofile.config.UPConfig
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    DeclarativeUserProfileProvider(org.keycloak.models.KeycloakSession session, DeclarativeUserProfileProviderFactory factory)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    protected org.keycloak.userprofile.UserProfileMetadata
    configureUserProfile(org.keycloak.userprofile.UserProfileMetadata metadata, org.keycloak.models.KeycloakSession session)
    Specifies how contextual profile metadata is configured at runtime.
    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)
     
    protected org.keycloak.component.ComponentModel
    Create the component model to store configuration
    protected org.keycloak.userprofile.AttributeValidatorMetadata
    createConfiguredValidator(String validator, Map<String,Object> validatorConfig)
    Create validator for validation configured in the user profile config.
    protected org.keycloak.userprofile.UserProfileMetadata
    decorateUserProfileForCache(org.keycloak.userprofile.UserProfileMetadata decoratedMetadata, org.keycloak.representations.userprofile.config.UPConfig parsedConfig)
    Decorate basic metadata based on 'per realm' configuration.
    org.keycloak.representations.userprofile.config.UPConfig
     
    protected org.keycloak.representations.userprofile.config.UPConfig
    parseConfigOrDefault(org.keycloak.component.ComponentModel component)
    Get parsed config file configured in model.
    void
    setConfiguration(org.keycloak.representations.userprofile.config.UPConfig configuration)
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • UP_COMPONENT_CONFIG_KEY

      public static final String UP_COMPONENT_CONFIG_KEY
      See Also:
    • PARSED_CONFIG_COMPONENT_KEY

      protected static final String PARSED_CONFIG_COMPONENT_KEY
      See Also:
    • PARSED_UP_CONFIG_COMPONENT_KEY

      protected static final String PARSED_UP_CONFIG_COMPONENT_KEY
      See Also:
    • parsedDefaultRawConfig

      protected final org.keycloak.representations.userprofile.config.UPConfig parsedDefaultRawConfig
  • Constructor Details

  • Method Details

    • 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)
    • 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
    • configureUserProfile

      protected org.keycloak.userprofile.UserProfileMetadata configureUserProfile(org.keycloak.userprofile.UserProfileMetadata metadata, org.keycloak.models.KeycloakSession session)
      Specifies how contextual profile metadata is configured at runtime.
      Parameters:
      metadata - the profile metadata
      Returns:
      the metadata
    • getConfiguration

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

      public void setConfiguration(org.keycloak.representations.userprofile.config.UPConfig configuration)
      Specified by:
      setConfiguration in interface org.keycloak.userprofile.UserProfileProvider
    • decorateUserProfileForCache

      protected org.keycloak.userprofile.UserProfileMetadata decorateUserProfileForCache(org.keycloak.userprofile.UserProfileMetadata decoratedMetadata, org.keycloak.representations.userprofile.config.UPConfig parsedConfig)
      Decorate basic metadata based on 'per realm' configuration. This method is called for each UserProfileContext in each realm, and metadata are cached then and this method is called again only if configuration changes.
    • parseConfigOrDefault

      protected org.keycloak.representations.userprofile.config.UPConfig parseConfigOrDefault(org.keycloak.component.ComponentModel component)
      Get parsed config file configured in model. Default one used if not configured.
    • createComponentModel

      protected org.keycloak.component.ComponentModel createComponentModel()
      Create the component model to store configuration
      Returns:
      component model
    • createConfiguredValidator

      protected org.keycloak.userprofile.AttributeValidatorMetadata createConfiguredValidator(String validator, Map<String,Object> validatorConfig)
      Create validator for validation configured in the user profile config.
      Parameters:
      validator - id to create validator for
      validatorConfig - of the validator
      Returns:
      validator metadata to run given validation
    • close

      public void close()
      Specified by:
      close in interface org.keycloak.provider.Provider