Package org.keycloak.userprofile
Class DeclarativeUserProfileProvider
java.lang.Object
org.keycloak.userprofile.DeclarativeUserProfileProvider
- All Implemented Interfaces:
Provider,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 -
Constructor Summary
ConstructorsConstructorDescriptionDeclarativeUserProfileProvider(KeycloakSession session, DeclarativeUserProfileProviderFactory factory) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected UserProfileMetadataconfigureUserProfile(UserProfileMetadata metadata, KeycloakSession session) Specifies how contextual profile metadata is configured at runtime.create(UserProfileContext context, Map<String, ?> attributes) create(UserProfileContext context, Map<String, ?> attributes, UserModel user) create(UserProfileContext context, UserModel user) protected AttributescreateAttributes(UserProfileContext context, Map<String, ?> attributes, UserModel user, UserProfileMetadata metadata) protected ComponentModelCreate the component model to store configurationprotected AttributeValidatorMetadatacreateConfiguredValidator(String validator, Map<String, Object> validatorConfig) Create validator for validation configured in the user profile config.protected UserProfileMetadatadecorateUserProfileForCache(UserProfileMetadata decoratedMetadata, org.keycloak.representations.userprofile.config.UPConfig parsedConfig) Decorate basic metadata based on 'per realm' configuration.org.keycloak.representations.userprofile.config.UPConfigprotected org.keycloak.representations.userprofile.config.UPConfigparseConfigOrDefault(ComponentModel component) Get parsed config file configured in model.voidsetConfiguration(org.keycloak.representations.userprofile.config.UPConfig configuration)
-
Field Details
-
UP_COMPONENT_CONFIG_KEY
- See Also:
-
PARSED_CONFIG_COMPONENT_KEY
- See Also:
-
PARSED_UP_CONFIG_COMPONENT_KEY
- See Also:
-
parsedDefaultRawConfig
protected final org.keycloak.representations.userprofile.config.UPConfig parsedDefaultRawConfig
-
-
Constructor Details
-
DeclarativeUserProfileProvider
public DeclarativeUserProfileProvider(KeycloakSession session, DeclarativeUserProfileProviderFactory factory)
-
-
Method Details
-
createAttributes
protected Attributes createAttributes(UserProfileContext context, Map<String, ?> attributes, UserModel user, UserProfileMetadata metadata) -
create
- Specified by:
createin interfaceUserProfileProvider
-
create
- Specified by:
createin interfaceUserProfileProvider
-
create
- Specified by:
createin interfaceUserProfileProvider
-
configureUserProfile
protected UserProfileMetadata configureUserProfile(UserProfileMetadata metadata, 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:
getConfigurationin interfaceUserProfileProvider
-
setConfiguration
public void setConfiguration(org.keycloak.representations.userprofile.config.UPConfig configuration) - Specified by:
setConfigurationin interfaceUserProfileProvider
-
decorateUserProfileForCache
protected UserProfileMetadata decorateUserProfileForCache(UserProfileMetadata decoratedMetadata, org.keycloak.representations.userprofile.config.UPConfig parsedConfig) Decorate basic metadata based on 'per realm' configuration. This method is called for eachUserProfileContextin 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(ComponentModel component) Get parsed config file configured in model. Default one used if not configured. -
createComponentModel
Create the component model to store configuration- Returns:
- component model
-
createConfiguredValidator
protected AttributeValidatorMetadata createConfiguredValidator(String validator, Map<String, Object> validatorConfig) Create validator for validation configured in the user profile config.- Parameters:
validator- id to create validator forvalidatorConfig- of the validator- Returns:
- validator metadata to run given validation
-
close
public void close()
-