Interface UserProfile
-
- All Known Implementing Classes:
DefaultUserProfile
public interface UserProfileAn interface providing as an entry point for managing users.
A
UserProfileprovides a manageable view for user information that also takes into account the context where it is being used. The context represents the different places in Keycloak where users are created, updated, or validated. Examples of contexts are: managing users through the Admin API, or through the Account API.By taking the context into account, the state and behavior of
UserProfileinstances depend on the context they are associated with, where validating, updating, creating, or obtaining representations of users is based on the configuration and constraints associated with a context.A
UserProfileinstance can be obtained through theUserProfileProvider.- Author:
- Markus Till
- See Also:
UserProfileContext,UserProfileProvider
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description UserModelcreate()Creates a newUserModelbased on the attributes associated with this instance.AttributesgetAttributes()Returns the attributes associated with this instance.voidupdate(boolean removeAttributes, AttributeChangeListener... changeListener)Updates theUserModelassociated with this instance.default voidupdate(AttributeChangeListener... changeListener)The same as#update(boolean, BiConsumer[])but forcing the removal of attributes.voidvalidate()Validates the attributes associated with this instance.
-
-
-
Method Detail
-
validate
void validate() throws ValidationExceptionValidates the attributes associated with this instance.- Throws:
ValidationException- in case
-
create
UserModel create() throws ValidationException
Creates a newUserModelbased on the attributes associated with this instance.- Returns:
- the
UserModelinstance created from this profile - Throws:
ValidationException- in case validation fails
-
update
void update(boolean removeAttributes, AttributeChangeListener... changeListener) throws ValidationExceptionUpdates the
UserModelassociated with this instance. If noUserModelis associated with this instance, this operation has no effect.Before updating the
UserModel, this method first checks whether thevalidate()method was previously invoked. If not, the validation step is performed prior to updating the model.- Parameters:
removeAttributes- if attributes should be removed from theUserModelif they are not among the attributes associated with this instance.changeListener- a set of one or more listeners to listen for attribute changes- Throws:
ValidationException- in case of any validation error
-
update
default void update(AttributeChangeListener... changeListener) throws ValidationException, RuntimeException
The same as
#update(boolean, BiConsumer[])but forcing the removal of attributes.- Parameters:
changeListener- a set of one or more listeners to listen for attribute changes- Throws:
ValidationException- in case of any validation errorRuntimeException
-
getAttributes
Attributes getAttributes()
Returns the attributes associated with this instance. Note that the attributes returned by this method are not necessarily the same from theUserModel, but those that should be validated and possibly updated to theUserModel.- Returns:
- the attributes associated with this instance.
-
-