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.
Constructor and Description |
---|
DefaultUserProfile(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, wait
update
public DefaultUserProfile(Attributes attributes, Function<Attributes,UserModel> userCreator, UserModel user, KeycloakSession session)
public void validate()
UserProfile
validate
in interface UserProfile
public UserModel create() throws ValidationException
UserProfile
UserModel
based on the attributes associated with this instance.create
in interface UserProfile
UserModel
instance created from this profileValidationException
- in case validation failspublic void update(boolean removeAttributes, BiConsumer<String,UserModel>... changeListener)
UserProfile
Updates 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 UserProfile
removeAttributes
- 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()
UserProfile
UserModel
, but those that should be validated and possibly updated to the UserModel
.getAttributes
in interface UserProfile
Copyright © 2021 JBoss by Red Hat. All rights reserved.