Package 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
Enables legacy support when managing attributes without the declarative provider.
- Author:
- Pedro Igor
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Field Summary
Fields inherited from class org.keycloak.userprofile.DefaultAttributes
context, DEFAULT_MAX_LENGTH_ATTRIBUTES, READ_ONLY_ATTRIBUTE_KEY, session, user
Fields inherited from interface org.keycloak.userprofile.Attributes
EMPTY_VALUE
-
Constructor Summary
ConstructorDescriptionLegacyAttributes
(UserProfileContext context, Map<String, ?> attributes, UserModel user, UserProfileMetadata profileMetadata, KeycloakSession session) -
Method Summary
Modifier and TypeMethodDescriptionReturns only the attributes that have read permissions in a particularUserProfileContext
.Returns all the attributes with read-write permissions in a particularUserProfileContext
.protected boolean
boolean
isReadOnly
(String name) 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
addDefaultValidators, contains, createAttributeContext, get, getMetadata, getUnmanagedAttributes, isReadOnlyFromMetadata, isReadOnlyInternalAttribute, isRequired, isServiceAccountUser, nameSet, normalizeAttributeValues, 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
getFirst
-
Constructor Details
-
LegacyAttributes
public LegacyAttributes(UserProfileContext context, Map<String, ?> attributes, UserModel user, UserProfileMetadata profileMetadata, KeycloakSession session)
-
-
Method Details
-
isSupportedAttribute
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 classDefaultAttributes
- Parameters:
name
- the name of the attribute- Returns:
-
isReadOnly
Description copied from interface:Attributes
Checks whether an attribute is read-only.- Specified by:
isReadOnly
in interfaceAttributes
- Overrides:
isReadOnly
in classDefaultAttributes
- Parameters:
name
- the attribute name- Returns:
true
if the attribute is read-only. Otherwise,false
-
getReadable
Description copied from interface:Attributes
Returns only the attributes that have read permissions in a particularUserProfileContext
.- Specified by:
getReadable
in interfaceAttributes
- Overrides:
getReadable
in classDefaultAttributes
- Returns:
- the attributes with read permission.
-
getWritable
Description copied from interface:Attributes
Returns all the attributes with read-write permissions in a particularUserProfileContext
.- Specified by:
getWritable
in interfaceAttributes
- Overrides:
getWritable
in classDefaultAttributes
- Returns:
- the attributes
-
isIncludeAttributeIfNotProvided
- Overrides:
isIncludeAttributeIfNotProvided
in classDefaultAttributes
-