public class DeclarativeUserProfileProvider extends AbstractUserProfileProvider<DeclarativeUserProfileProvider> implements AmphibianProviderFactory<DeclarativeUserProfileProvider>, EnvironmentDependentProviderFactory
UserProfileProvider
loading configuration from the changeable JSON file stored in component config. Parsed
configuration is cached.Modifier and Type | Field and Description |
---|---|
static String |
ID |
static String |
SYSTEM_DEFAULT_CONFIG_RESOURCE |
static String |
UP_PIECES_COUNT_COMPONENT_CONFIG_KEY |
contextualMetadataRegistry, session
Constructor and Description |
---|
DeclarativeUserProfileProvider() |
DeclarativeUserProfileProvider(KeycloakSession session,
Map<UserProfileContext,UserProfileMetadata> metadataRegistry,
String defaultRawConfig) |
Modifier and Type | Method and Description |
---|---|
protected UserProfileMetadata |
configureUserProfile(UserProfileMetadata metadata,
KeycloakSession session)
Sub-types can override this method to customize how contextual profile metadata is configured at runtime.
|
protected DeclarativeUserProfileProvider |
create(KeycloakSession session,
Map<UserProfileContext,UserProfileMetadata> metadataRegistry)
Subclasses can override this method to create their instances of
UserProfileProvider . |
protected Attributes |
createAttributes(UserProfileContext context,
Map<String,?> attributes,
UserModel user,
UserProfileMetadata metadata) |
protected AttributeValidatorMetadata |
createConfiguredValidator(String validator,
Map<String,Object> validatorConfig)
Create validator for validation configured in the user profile config.
|
protected UserProfileMetadata |
decorateUserProfileForCache(UserProfileMetadata metadata,
ComponentModel model)
Decorate basic metadata provided from
AbstractUserProfileProvider based on 'per realm' configuration. |
ComponentModel |
getComponentModel() |
List<ProviderConfigProperty> |
getConfigProperties() |
String |
getConfiguration()
Get current UserProfile configuration.
|
String |
getHelpText() |
String |
getId() |
protected UPConfig |
getParsedConfig(ComponentModel model)
Get parsed config file configured in model.
|
boolean |
isSupported() |
void |
postInit(KeycloakSessionFactory factory)
Called after all provider factories have been initialized
|
void |
setConfiguration(String configuration)
Set new UserProfile configuration.
|
void |
validateConfiguration(KeycloakSession session,
RealmModel realm,
ComponentModel model)
Called before a component is created or updated.
|
close, configureUserProfile, create, create, create, create, getRegexPatternString, init
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, create, create, onUpdate, preRemove
getCommonProviderConfigProperties, getTypeMetadata, onCreate
init, order
public static final String SYSTEM_DEFAULT_CONFIG_RESOURCE
public static final String ID
public static final String UP_PIECES_COUNT_COMPONENT_CONFIG_KEY
public DeclarativeUserProfileProvider()
public DeclarativeUserProfileProvider(KeycloakSession session, Map<UserProfileContext,UserProfileMetadata> metadataRegistry, String defaultRawConfig)
public String getId()
getId
in interface ProviderFactory<DeclarativeUserProfileProvider>
protected DeclarativeUserProfileProvider create(KeycloakSession session, Map<UserProfileContext,UserProfileMetadata> metadataRegistry)
AbstractUserProfileProvider
UserProfileProvider
.create
in class AbstractUserProfileProvider<DeclarativeUserProfileProvider>
session
- the sessionmetadataRegistry
- the profile metadataprotected Attributes createAttributes(UserProfileContext context, Map<String,?> attributes, UserModel user, UserProfileMetadata metadata)
createAttributes
in class AbstractUserProfileProvider<DeclarativeUserProfileProvider>
protected UserProfileMetadata configureUserProfile(UserProfileMetadata metadata, KeycloakSession session)
AbstractUserProfileProvider
configureUserProfile
in class AbstractUserProfileProvider<DeclarativeUserProfileProvider>
metadata
- the profile metadatapublic String getHelpText()
getHelpText
in interface ConfiguredProvider
public void validateConfiguration(KeycloakSession session, RealmModel realm, ComponentModel model) throws ComponentValidationException
ComponentFactory
validateConfiguration
in interface ComponentFactory<DeclarativeUserProfileProvider,DeclarativeUserProfileProvider>
ComponentValidationException
public String getConfiguration()
UserProfileProvider
getConfiguration
in interface UserProfileProvider
getConfiguration
in class AbstractUserProfileProvider<DeclarativeUserProfileProvider>
UserProfileProvider.setConfiguration(String)
public void setConfiguration(String configuration)
UserProfileProvider
setConfiguration
in interface UserProfileProvider
setConfiguration
in class AbstractUserProfileProvider<DeclarativeUserProfileProvider>
configuration
- to be setUserProfileProvider.getConfiguration()
public void postInit(KeycloakSessionFactory factory)
ProviderFactory
postInit
in interface ProviderFactory<DeclarativeUserProfileProvider>
postInit
in class AbstractUserProfileProvider<DeclarativeUserProfileProvider>
public List<ProviderConfigProperty> getConfigProperties()
getConfigProperties
in interface AmphibianProviderFactory<DeclarativeUserProfileProvider>
getConfigProperties
in interface ConfiguredProvider
public ComponentModel getComponentModel()
protected UserProfileMetadata decorateUserProfileForCache(UserProfileMetadata metadata, ComponentModel model)
AbstractUserProfileProvider
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.metadata
- base to be decorated based on configuration loaded from component modelmodel
- component model to get "per realm" configuration fromprotected UPConfig getParsedConfig(ComponentModel model)
model
- to take config fromprotected AttributeValidatorMetadata createConfiguredValidator(String validator, Map<String,Object> validatorConfig)
validator
- id to create validator forvalidatorConfig
- of the validatorpublic boolean isSupported()
isSupported
in interface EnvironmentDependentProviderFactory
true
if the provider is supported and should be available, false
otherwiseCopyright © 2021 JBoss by Red Hat. All rights reserved.