Class ServiceAccountAttributes

java.lang.Object
java.util.AbstractMap<K,V>
java.util.HashMap<String,List<String>>
org.keycloak.userprofile.DefaultAttributes
org.keycloak.userprofile.ServiceAccountAttributes
All Implemented Interfaces:
Serializable, Cloneable, Map<String,List<String>>, org.keycloak.userprofile.Attributes

public class ServiceAccountAttributes extends org.keycloak.userprofile.DefaultAttributes

A specific Attributes implementation to handle service accounts.

Service accounts are not regular users, and it should be possible to manage unmanaged attributes but only when operating through the UserProfileContext.USER_API. Otherwise, administrators will be forced to enable unmanaged attributes by setting a UPConfig.UnmanagedAttributePolicy or end up defining managed attributes that are specific for service accounts in the user profile configuration, which is mainly targeted for regular users.

Author:
Pedro Igor
See Also:
  • Constructor Details

    • ServiceAccountAttributes

      public ServiceAccountAttributes(org.keycloak.userprofile.UserProfileContext context, Map<String,?> attributes, org.keycloak.models.UserModel user, org.keycloak.userprofile.UserProfileMetadata profileMetadata, org.keycloak.models.KeycloakSession session)
  • Method Details

    • isReadOnly

      public boolean isReadOnly(String name)
      Specified by:
      isReadOnly in interface org.keycloak.userprofile.Attributes
      Overrides:
      isReadOnly in class org.keycloak.userprofile.DefaultAttributes
    • createUnmanagedAttributeMetadata

      protected org.keycloak.userprofile.AttributeMetadata createUnmanagedAttributeMetadata(String name)
      Overrides:
      createUnmanagedAttributeMetadata in class org.keycloak.userprofile.DefaultAttributes
    • isAllowUnmanagedAttribute

      protected boolean isAllowUnmanagedAttribute()
      Overrides:
      isAllowUnmanagedAttribute in class org.keycloak.userprofile.DefaultAttributes
    • setUserName

      protected void setUserName(Map<String,List<String>> newAttributes, List<String> values)
      Overrides:
      setUserName in class org.keycloak.userprofile.DefaultAttributes