Package org.keycloak.userprofile.config
Class UPConfigUtils
java.lang.Object
org.keycloak.userprofile.config.UPConfigUtils
Utility methods to work with User Profile Configurations
- Author:
- Vlastimil Elias <velias@redhat.com>
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
static boolean
isValidAttributeName
(String attributeName) static UPConfig
parseConfig
(String rawConfig) Parse configuration of user-profile from Stringstatic UPConfig
parseConfig
(Path configPath) static UPConfig
static UPConfig
Load configuration from JSON file.static String
validate
(KeycloakSession session, UPConfig config) Validate object representation of the configuration.
-
Field Details
-
ROLE_USER
- See Also:
-
ROLE_ADMIN
- See Also:
-
ATTRIBUTE_NAME_PATTERN
-
-
Constructor Details
-
UPConfigUtils
public UPConfigUtils()
-
-
Method Details
-
readConfig
Load configuration from JSON file.Configuration is not validated, use
validate(KeycloakSession, UPConfig)
to validate it and get list of errors.- Parameters:
is
- JSON file to be loaded- Returns:
- object representation of the configuration
- Throws:
IOException
- if JSON configuration can't be loaded (eg due to JSON format errors etc)
-
parseConfig
Parse configuration of user-profile from String- Parameters:
rawConfig
- Configuration in String format- Returns:
- object representation of the configuration
- Throws:
IOException
- if JSON configuration can't be loaded (eg due to JSON format errors etc)
-
validate
Validate object representation of the configuration. Validations:- defaultProfile is defined and exists in profiles
- parent exists for type
- type exists for attribute
- validator (from Validator SPI) exists for validation and it's config is correct
- if an attribute group is configured it is verified that this group exists
- all groups have a name != null
- Parameters:
session
- to be used for Validator SPI integrationconfig
- to validate- Returns:
- list of errors, empty if no error found
-
isValidAttributeName
- Parameters:
attributeName
- to validate- Returns:
-
capitalizeFirstLetter
-
readSystemDefaultConfig
-
parseSystemDefaultConfig
-
parseConfig
-