public final class DefaultUserProfile extends Object implements UserProfile
The default implementation for UserProfile. Should be reused as much as possible by the different implementations
of UserProfileProvider.
This implementation is not specific to any user profile implementation.
| Modifier and Type | Field and Description |
|---|---|
protected UserProfileMetadata |
metadata |
| Constructor and Description |
|---|
DefaultUserProfile(UserProfileMetadata metadata,
Attributes attributes,
Function<Attributes,UserModel> userCreator,
UserModel user,
KeycloakSession session) |
| Modifier and Type | Method and Description |
|---|---|
UserModel |
create()
Creates a new
UserModel based on the attributes associated with this instance. |
Attributes |
getAttributes()
Returns the attributes associated with this instance.
|
void |
update(boolean removeAttributes,
BiConsumer<String,UserModel>... changeListener)
Updates the
UserModel associated with this instance. |
void |
validate()
Validates the attributes associated with this instance.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitupdateprotected final UserProfileMetadata metadata
public DefaultUserProfile(UserProfileMetadata metadata, Attributes attributes, Function<Attributes,UserModel> userCreator, UserModel user, KeycloakSession session)
public void validate()
UserProfilevalidate in interface UserProfilepublic UserModel create() throws ValidationException
UserProfileUserModel based on the attributes associated with this instance.create in interface UserProfileUserModel instance created from this profileValidationException - in case validation failspublic void update(boolean removeAttributes,
BiConsumer<String,UserModel>... changeListener)
UserProfileUpdates the UserModel associated with this instance. If no UserModel is associated with this instance, this operation has no effect.
Before updating the UserModel, this method first checks whether the UserProfile.validate() method was previously
invoked. If not, the validation step is performed prior to updating the model.
update in interface UserProfileremoveAttributes - if attributes should be removed from the UserModel if they are not among the attributes associated with this instance.changeListener - a set of one or more listeners to listen for attribute changespublic Attributes getAttributes()
UserProfileUserModel, but those that should be validated and possibly updated to the UserModel.getAttributes in interface UserProfileCopyright © 2021 JBoss by Red Hat. All rights reserved.