org.keycloak.userprofile

## Class LegacyAttributes

- java.lang.Object
- - java.util.AbstractMap<K,V>
  - - java.util.HashMap<String,List<String>>
    - - org.keycloak.userprofile.DefaultAttributes
      - - org.keycloak.userprofile.LegacyAttributes

- All Implemented Interfaces:
    Serializable, Cloneable, Map<String,List<String>>, Attributes

      public class LegacyAttributes
      extends DefaultAttributes

  Enables legacy support when managing attributes without the declarative provider.
  Author:
    Pedro Igor
  See Also:
    Serialized Form

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from class java.util.AbstractMap

      `AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>`

    - ### Nested classes/interfaces inherited from interface java.util.Map

      `Map.Entry<K,V>`

  - ### Field Summary

    - ### Fields inherited from class org.keycloak.userprofile.DefaultAttributes

      `context, READ_ONLY_ATTRIBUTE_KEY, user`

    - ### Fields inherited from interface org.keycloak.userprofile.Attributes

      `EMPTY_VALUE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `LegacyAttributes(UserProfileContext context, Map<String,?> attributes, UserModel user, UserProfileMetadata profileMetadata, KeycloakSession session)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Map<String,List<String>>` | `getReadable()` Returns only the attributes that have read/write permissions.
    `protected boolean` | `isIncludeAttributeIfNotProvided(AttributeMetadata metadata)`
    `boolean` | `isReadOnly(String attributeName)` Checks whether an attribute is read-only.
    `protected boolean` | `isSupportedAttribute(String name)` Checks whether an attribute is support by the profile configuration and the current context.

    - ### Methods inherited from class org.keycloak.userprofile.DefaultAttributes

      `attributeSet, contains, createAttributeContext, getMetadata, getValues, isReadOnlyFromMetadata, isReadOnlyInternalAttribute, isRequired, nameSet, toMap, validate`

    - ### Methods inherited from class java.util.HashMap

      `clear, clone, compute, computeIfAbsent, computeIfPresent, containsKey, containsValue, entrySet, forEach, get, getOrDefault, isEmpty, keySet, merge, put, putAll, putIfAbsent, remove, remove, replace, replace, replaceAll, size, values`

    - ### Methods inherited from class java.util.AbstractMap

      `equals, hashCode, toString`

    - ### Methods inherited from class java.lang.Object

      `finalize, getClass, notify, notifyAll, wait, wait, wait`

    - ### Methods inherited from interface org.keycloak.userprofile.Attributes

      `getFirstValue, getReadable, isRootAttribute`

    - ### Methods inherited from interface java.util.Map

      `equals, hashCode`

- - ### Constructor Detail

    - #### LegacyAttributes

          public LegacyAttributes(UserProfileContext context,
                                  Map<String,?> attributes,
                                  UserModel user,
                                  UserProfileMetadata profileMetadata,
                                  KeycloakSession session)

  - ### Method Detail

    - #### isSupportedAttribute

          protected boolean isSupportedAttribute(String name)

      Description copied from class: `DefaultAttributes`

      Checks whether an attribute is support by the profile configuration and the current context.

      This method can be used to avoid unexpected attributes from being added as an attribute because the attribute source is a regular `Map` and not normalized.

      Overrides:
        `isSupportedAttribute` in class `DefaultAttributes`
      Parameters:
        `name` - the name of the attribute
      Returns:

    - #### isReadOnly

          public boolean isReadOnly(String attributeName)

      Description copied from interface: `Attributes`
      Checks whether an attribute is read-only.
      Specified by:
        `isReadOnly` in interface `Attributes`
      Overrides:
        `isReadOnly` in class `DefaultAttributes`
      Returns:

    - #### getReadable

          public Map<String,List<String>> getReadable()

      Description copied from interface: `Attributes`
      Returns only the attributes that have read/write permissions.
      Specified by:
        `getReadable` in interface `Attributes`
      Overrides:
        `getReadable` in class `DefaultAttributes`
      Returns:
        the attributes with read/write permission.

    - #### isIncludeAttributeIfNotProvided

          protected boolean isIncludeAttributeIfNotProvided(AttributeMetadata metadata)

      Overrides:
        `isIncludeAttributeIfNotProvided` in class `DefaultAttributes`

Copyright © 2021 JBoss by Red Hat. All rights reserved.