Class UserProfileUtil

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

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

    Fields
    Modifier and Type
    Field
    Description
    static final Predicate<org.keycloak.userprofile.AttributeContext>
     
    static final String
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static org.keycloak.userprofile.AttributeMetadata
    createAttributeMetadata(String attrName, org.keycloak.userprofile.UserProfileMetadata metadata, int guiOrder, String storageProviderName)
     
    static org.keycloak.userprofile.AttributeMetadata
    createAttributeMetadata(String attrName, org.keycloak.userprofile.UserProfileMetadata metadata, org.keycloak.userprofile.AttributeGroupMetadata metadataGroup, int guiOrder, String storageProviderName)
    Adds metadata attribute to the user-profile for users from specified userStorageProvider
    static org.keycloak.representations.idm.UserProfileMetadata
    createUserProfileMetadata(org.keycloak.models.KeycloakSession session, UserProfile profile)
     
    static boolean
    Returns whether the attribute with the given name is a root attribute.
    static org.keycloak.userprofile.AttributeGroupMetadata
    lookupUserMetadataGroup(org.keycloak.models.KeycloakSession session)
    Find the metadata group "user-metadata"

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • USER_METADATA_GROUP

      public static final String USER_METADATA_GROUP
      See Also:
    • ONLY_ADMIN_CONDITION

      public static final Predicate<org.keycloak.userprofile.AttributeContext> ONLY_ADMIN_CONDITION
  • Constructor Details

    • UserProfileUtil

      public UserProfileUtil()
  • Method Details

    • lookupUserMetadataGroup

      public static org.keycloak.userprofile.AttributeGroupMetadata lookupUserMetadataGroup(org.keycloak.models.KeycloakSession session)
      Find the metadata group "user-metadata"
      Parameters:
      session -
      Returns:
      metadata group if exists, otherwise null
    • createAttributeMetadata

      public static org.keycloak.userprofile.AttributeMetadata createAttributeMetadata(String attrName, org.keycloak.userprofile.UserProfileMetadata metadata, org.keycloak.userprofile.AttributeGroupMetadata metadataGroup, 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
      guiOrder - guiOrder to where to put the attribute
      storageProviderName - storageProviderName (just for logging purposes)
      Returns:
      the attribute metadata if attribute was created. False otherwise
    • createAttributeMetadata

      public static org.keycloak.userprofile.AttributeMetadata createAttributeMetadata(String attrName, org.keycloak.userprofile.UserProfileMetadata metadata, int guiOrder, String storageProviderName)
    • 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 org.keycloak.representations.idm.UserProfileMetadata createUserProfileMetadata(org.keycloak.models.KeycloakSession session, UserProfile profile)