Package org.keycloak.userprofile
Class DefaultUserProfile
- java.lang.Object
- 
- org.keycloak.userprofile.DefaultUserProfile
 
- 
- All Implemented Interfaces:
- UserProfile
 
 public final class DefaultUserProfile extends Object implements UserProfile The default implementation for UserProfile. Should be reused as much as possible by the different implementations ofUserProfileProvider.This implementation is not specific to any user profile implementation. - Author:
- Pedro Igor
 
- 
- 
Field SummaryFields Modifier and Type Field Description protected UserProfileMetadatametadata
 - 
Constructor SummaryConstructors Constructor Description DefaultUserProfile(UserProfileMetadata metadata, Attributes attributes, Function<Attributes,UserModel> userCreator, UserModel user, KeycloakSession session)
 - 
Method SummaryAll Methods Instance Methods Concrete 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.voidvalidate()Validates the attributes associated with this instance.- 
Methods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 - 
Methods inherited from interface org.keycloak.userprofile.UserProfileupdate
 
- 
 
- 
- 
- 
Field Detail- 
metadataprotected final UserProfileMetadata metadata 
 
- 
 - 
Constructor Detail- 
DefaultUserProfilepublic DefaultUserProfile(UserProfileMetadata metadata, Attributes attributes, Function<Attributes,UserModel> userCreator, UserModel user, KeycloakSession session) 
 
- 
 - 
Method Detail- 
validatepublic void validate() Description copied from interface:UserProfileValidates the attributes associated with this instance.- Specified by:
- validatein interface- UserProfile
 
 - 
createpublic UserModel create() throws ValidationException Description copied from interface:UserProfileCreates a newUserModelbased on the attributes associated with this instance.- Specified by:
- createin interface- UserProfile
- Returns:
- the UserModelinstance created from this profile
- Throws:
- ValidationException- in case validation fails
 
 - 
updatepublic void update(boolean removeAttributes, AttributeChangeListener... changeListener)Description copied from interface:UserProfileUpdates 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 theUserProfile.validate()method was previously invoked. If not, the validation step is performed prior to updating the model.- Specified by:
- updatein interface- UserProfile
- Parameters:
- removeAttributes- if attributes should be removed from the- UserModelif they are not among the attributes associated with this instance.
- changeListener- a set of one or more listeners to listen for attribute changes
 
 - 
getAttributespublic Attributes getAttributes() Description copied from interface:UserProfileReturns 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.- Specified by:
- getAttributesin interface- UserProfile
- Returns:
- the attributes associated with this instance.
 
 
- 
 
-