public interface UserProfile
An interface providing as an entry point for managing users.
A UserProfile
provides 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 UserProfile
instances 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 UserProfile
instance can be obtained through the UserProfileProvider
.
UserProfileContext
,
UserProfileProvider
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.
|
default void |
update(BiConsumer<String,UserModel>... changeListener)
The same as
update(boolean, BiConsumer[]) but forcing the removal of attributes. |
void |
update(boolean removeAttributes,
BiConsumer<String,UserModel>... changeListener)
Updates the
UserModel associated with this instance. |
void |
validate()
Validates the attributes associated with this instance.
|
void validate() throws ValidationException
ValidationException
- in caseUserModel create() throws ValidationException
UserModel
based on the attributes associated with this instance.UserModel
instance created from this profileValidationException
- in case validation failsvoid update(boolean removeAttributes, BiConsumer<String,UserModel>... changeListener) throws ValidationException
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 validate()
method was previously
invoked. If not, the validation step is performed prior to updating the model.
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 changesValidationException
- in case of any validation errordefault void update(BiConsumer<String,UserModel>... changeListener) throws ValidationException, RuntimeException
The same as update(boolean, BiConsumer[])
but forcing the removal of attributes.
changeListener
- a set of one or more listeners to listen for attribute changesValidationException
- in case of any validation errorRuntimeException
Attributes getAttributes()
UserModel
, but those that should be validated and possibly updated to the UserModel
.Copyright © 2021 JBoss by Red Hat. All rights reserved.