Package org.keycloak.userprofile
Class UserProfileUtil
java.lang.Object
org.keycloak.userprofile.UserProfileUtil
- Author:
- Marek Posolda
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic boolean
addMetadataAttributeToUserProfile
(String attrName, UserProfileMetadata metadata, AttributeGroupMetadata metadataGroup, Predicate<AttributeContext> userFederationUsersSelector, int guiOrder, String storageProviderName) Adds metadata attribute to the user-profile for users from specified userStorageProviderstatic UserProfileMetadata
createUserProfileMetadata
(KeycloakSession session, UserProfile profile) static boolean
isRootAttribute
(String name) Returns whether the attribute with the givenname
is a root attribute.static AttributeGroupMetadata
lookupUserMetadataGroup
(KeycloakSession session) Find the metadata group "user-metadata"
-
Field Details
-
USER_METADATA_GROUP
- See Also:
-
-
Constructor Details
-
UserProfileUtil
public UserProfileUtil()
-
-
Method Details
-
lookupUserMetadataGroup
Find the metadata group "user-metadata"- Parameters:
session
-- Returns:
- metadata group if exists, otherwise null
-
addMetadataAttributeToUserProfile
public static boolean addMetadataAttributeToUserProfile(String attrName, UserProfileMetadata metadata, AttributeGroupMetadata metadataGroup, Predicate<AttributeContext> userFederationUsersSelector, int guiOrder, String storageProviderName) Adds metadata attribute to the user-profile for users from specified userStorageProvider- Parameters:
attrName
- attribute namemetadata
- user-profile metadata where attribute would be addedmetadataGroup
- metadata group in user-profileuserFederationUsersSelector
- used to recognize if user belongs to this user-storage provider or notguiOrder
- guiOrder to where to put the attributestorageProviderName
- storageProviderName (just for logging purposes)- Returns:
- true if attribute was added. False otherwise
-
isRootAttribute
Returns whether the attribute with the givenname
is a root attribute.- Parameters:
name
- the attribute name- Returns:
-
createUserProfileMetadata
public static UserProfileMetadata createUserProfileMetadata(KeycloakSession session, UserProfile profile)
-