Package org.keycloak.userprofile
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 -
Constructor Summary
ConstructorsConstructorDescriptionDeclarativeUserProfileProvider(org.keycloak.models.KeycloakSession session, DeclarativeUserProfileProviderFactory factory) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()protected org.keycloak.userprofile.UserProfileMetadataconfigureUserProfile(org.keycloak.userprofile.UserProfileMetadata metadata, org.keycloak.models.KeycloakSession session) Specifies how contextual profile metadata is configured at runtime.org.keycloak.userprofile.UserProfileorg.keycloak.userprofile.UserProfilecreate(org.keycloak.userprofile.UserProfileContext context, Map<String, ?> attributes, org.keycloak.models.UserModel user) org.keycloak.userprofile.UserProfilecreate(org.keycloak.userprofile.UserProfileContext context, org.keycloak.models.UserModel user) protected org.keycloak.userprofile.AttributescreateAttributes(org.keycloak.userprofile.UserProfileContext context, Map<String, ?> attributes, org.keycloak.models.UserModel user, org.keycloak.userprofile.UserProfileMetadata metadata) protected org.keycloak.component.ComponentModelCreate the component model to store configurationprotected org.keycloak.userprofile.AttributeValidatorMetadatacreateConfiguredValidator(String validator, Map<String, Object> validatorConfig) Create validator for validation configured in the user profile config.protected org.keycloak.userprofile.UserProfileMetadatadecorateUserProfileForCache(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.UPConfigprotected org.keycloak.representations.userprofile.config.UPConfigparseConfigOrDefault(org.keycloak.component.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(org.keycloak.models.KeycloakSession session, DeclarativeUserProfileProviderFactory factory)
-
-
Method Details
-
createAttributes
-
create
public org.keycloak.userprofile.UserProfile create(org.keycloak.userprofile.UserProfileContext context, org.keycloak.models.UserModel user) - Specified by:
createin interfaceorg.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:
createin interfaceorg.keycloak.userprofile.UserProfileProvider
-
create
public org.keycloak.userprofile.UserProfile create(org.keycloak.userprofile.UserProfileContext context, Map<String, ?> attributes) - Specified by:
createin interfaceorg.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:
getConfigurationin interfaceorg.keycloak.userprofile.UserProfileProvider
-
setConfiguration
public void setConfiguration(org.keycloak.representations.userprofile.config.UPConfig configuration) - Specified by:
setConfigurationin interfaceorg.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 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(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 forvalidatorConfig- of the validator- Returns:
- validator metadata to run given validation
-
close
public void close()- Specified by:
closein interfaceorg.keycloak.provider.Provider
-