Class UserProfileUtil

java.lang.Object
org.keycloak.userprofile.UserProfileUtil

public class UserProfileUtil extends Object
Author:
Marek Posolda
  • Field Details

  • Constructor Details

    • UserProfileUtil

      public UserProfileUtil()
  • Method Details

    • lookupUserMetadataGroup

      public static AttributeGroupMetadata lookupUserMetadataGroup(KeycloakSession session)
      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 name
      metadata - user-profile metadata where attribute would be added
      metadataGroup - metadata group in user-profile
      userFederationUsersSelector - used to recognize if user belongs to this user-storage provider or not
      guiOrder - guiOrder to where to put the attribute
      storageProviderName - storageProviderName (just for logging purposes)
      Returns:
      true if attribute was added. False otherwise
    • isRootAttribute

      public static boolean isRootAttribute(String name)
      Returns whether the attribute with the given name is a root attribute.
      Parameters:
      name - the attribute name
      Returns:
    • createUserProfileMetadata

      public static UserProfileMetadata createUserProfileMetadata(KeycloakSession session, UserProfile profile)