Package org.keycloak.userprofile
Interface Attributes
- All Known Implementing Classes:
DefaultAttributes,LegacyAttributes
public interface Attributes
This interface wraps the attributes associated with a user profile. Different operations are provided to access and manage these attributes.
- Author:
- Pedro Igor
-
Field Summary
FieldsModifier and TypeFieldDescriptionDefault value for attributes with no value set. -
Method Summary
Modifier and TypeMethodDescriptionbooleanChecks whether an attribute with the givennameis defined.default StringgetFirstValue(String name) Returns the first value associated with the attribute with the given .getMetadata(String name) Returns the metadata associated with the attribute with the givenname.Returns only the attributes that have read/write permissions.getReadable(boolean includeBuiltin) Similar to {getReadable(boolean)} but with the possibility to add or remove the root attributes.Returns all values for an attribute with the givenname.Returns all attributes that can be written.booleanisReadOnly(String key) Checks whether an attribute is read-only.booleanisRequired(String name) Returns whether the attribute with the givennameis required.default booleanisRootAttribute(String name) Returns whether the attribute with the givennameis a root attribute.nameSet()Returns the names of all defined attributes.toMap()booleanvalidate(String name, Consumer<ValidationError>... listeners) Validates the attribute with the givenname.
-
Field Details
-
EMPTY_VALUE
Default value for attributes with no value set.
-
-
Method Details
-
getFirstValue
Returns the first value associated with the attribute with the given .- Parameters:
name- the name of the attribute- Returns:
- the first value
-
getValues
Returns all values for an attribute with the givenname.- Parameters:
name- the name of the attribute- Returns:
- the attribute values
-
isReadOnly
Checks whether an attribute is read-only.- Parameters:
key-- Returns:
-
validate
Validates the attribute with the givenname.- Parameters:
name- the name of the attributelisteners- the listeners for listening for errors.ValidationError.inputHintcontains name of the attribute in error.- Returns:
trueif validation is successful. Otherwise,false. In case there is no attribute with the givenname,falseis also returned but without triggering listeners
-
contains
Checks whether an attribute with the givennameis defined.- Parameters:
name- the name of the attribute- Returns:
trueif the attribute is defined. Otherwise,false
-
nameSet
Returns the names of all defined attributes.- Returns:
- the set of attribute names
-
getWritable
Returns all attributes that can be written.- Returns:
- the attributes
-
getMetadata
Returns the metadata associated with the attribute with the given
name.The
AttributeMetadatais a copy of the original metadata. The original metadata keeps immutable.- Parameters:
name- the attribute name- Returns:
- the metadata
-
isRequired
Returns whether the attribute with the givennameis required.- Parameters:
name- the attribute name- Returns:
trueif the attribute is required. Otherwise,false.
-
getReadable
Similar to {getReadable(boolean)} but with the possibility to add or remove the root attributes.- Parameters:
includeBuiltin- if the root attributes should be included.- Returns:
- the attributes with read/write permission.
-
getReadable
Returns only the attributes that have read/write permissions.- Returns:
- the attributes with read/write permission.
-
isRootAttribute
Returns whether the attribute with the givennameis a root attribute.- Parameters:
name- the attribute name- Returns:
-
toMap
-