Package org.keycloak.models
Interface UserModel
- All Superinterfaces:
RoleMapperModel
- All Known Subinterfaces:
CachedUserModel
- All Known Implementing Classes:
AbstractInMemoryUserAdapter,AbstractUserAdapter,AbstractUserAdapter.Streams,AbstractUserAdapterFederatedStorage,AbstractUserAdapterFederatedStorage.Streams,GroupLDAPStorageMapper.LDAPGroupMappingsUserDelegate,InMemoryUserAdapter,IpatuuraUserModelDelegate,LDAPWritesOnlyUserModelDelegate,LightweightUserAdapter,MSADLDSUserAccountControlStorageMapper.MSADUserModelDelegate,MSADUserAccountControlStorageMapper.MSADUserModelDelegate,ReadOnlyKerberosUserModelDelegate,ReadonlyLDAPUserModelDelegate,ReadonlySSSDUserModelDelegate,ReadOnlyUserModelDelegate,RoleLDAPStorageMapper.LDAPRoleMappingsUserDelegate,TxAwareLDAPUserModelDelegate,UpdateOnlyChangeUserModelDelegate,UserAdapter,UserAdapter,UserModelDefaultMethods,UserModelDelegate
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic enumstatic interfacestatic interface -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Comparator<UserModel>static final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final Stringstatic final String -
Method Summary
Modifier and TypeMethodDescriptionvoidaddRequiredAction(String action) default voidInstance of a user credential manager to validate and update the credentials of this user.getAttributeStream(String name) Obtains all values associated with the specified attribute name.Get timestamp of user creation.getEmail()getFirstAttribute(String name) default longdefault longgetGroupsCountByNameContaining(String search) Obtains the groups associated with the user.default Stream<GroupModel>getGroupsStream(String search, Integer first, Integer max) Returns a paginated stream of groups within this realm with search in the namegetId()Obtains the aliases of required actions associated with the user.booleanbooleandefault booleanIndicates if thisUserModelmaps to a local account or an account federated from an external user storage.booleanisMemberOf(GroupModel group) voidjoinGroup(GroupModel group) default voidjoinGroup(GroupModel group, MembershipMetadata metadata) voidleaveGroup(GroupModel group) voidremoveAttribute(String name) voidremoveRequiredAction(String action) default voidvoidsetAttribute(String name, List<String> values) voidsetCreatedTimestamp(Long timestamp) voidSets email for this user.voidsetEmailVerified(boolean verified) voidsetEnabled(boolean enabled) voidsetFederationLink(String link) voidsetFirstName(String firstName) voidsetLastName(String lastName) voidsetServiceAccountClientLink(String clientInternalId) voidsetSingleAttribute(String name, String value) Set single value of specified attribute.voidsetUsername(String username) Sets username for this user.Methods inherited from interface org.keycloak.models.RoleMapperModel
deleteRoleMapping, getClientRoleMappingsStream, getRealmRoleMappingsStream, getRoleMappingsStream, grantRole, hasDirectRole, hasRole
-
Field Details
-
USERNAME
- See Also:
-
FIRST_NAME
- See Also:
-
LAST_NAME
- See Also:
-
EMAIL
- See Also:
-
EMAIL_VERIFIED
- See Also:
-
LOCALE
- See Also:
-
ENABLED
- See Also:
-
IDP_ALIAS
- See Also:
-
IDP_USER_ID
- See Also:
-
INCLUDE_SERVICE_ACCOUNT
- See Also:
-
GROUPS
- See Also:
-
SEARCH
- See Also:
-
EXACT
- See Also:
-
DISABLED_REASON
- See Also:
-
COMPARE_BY_USERNAME
-
-
Method Details
-
getId
String getId() -
getUsername
String getUsername() -
setUsername
Sets username for this user. No default method here to allow Abstract subclasses where the username is provided in a different manner- Parameters:
username- username string
-
getCreatedTimestamp
Long getCreatedTimestamp()Get timestamp of user creation. May be null for old users created before this feature introduction. -
setCreatedTimestamp
-
isEnabled
boolean isEnabled() -
setEnabled
void setEnabled(boolean enabled) -
setSingleAttribute
Set single value of specified attribute. Remove all other existing values of this attribute- Parameters:
name-value-
-
setAttribute
-
removeAttribute
-
getFirstAttribute
- Parameters:
name-- Returns:
- null if there is not any value of specified attribute or first value otherwise. Don't throw exception if there are more values of the attribute
-
getAttributeStream
Obtains all values associated with the specified attribute name.- Parameters:
name- the name of the attribute.- Returns:
- a non-null
Streamof attribute values.
-
getAttributes
-
getRequiredActionsStream
Obtains the aliases of required actions associated with the user.- Returns:
- a non-null
Streamof required action aliases.
-
addRequiredAction
-
removeRequiredAction
-
addRequiredAction
-
removeRequiredAction
-
getFirstName
String getFirstName() -
setFirstName
-
getLastName
String getLastName() -
setLastName
-
getEmail
String getEmail() -
setEmail
Sets email for this user.- Parameters:
email- the email
-
isEmailVerified
boolean isEmailVerified() -
setEmailVerified
void setEmailVerified(boolean verified) -
getGroupsStream
Stream<GroupModel> getGroupsStream()Obtains the groups associated with the user.- Returns:
- a non-null
Streamof groups.
-
getGroupsStream
Returns a paginated stream of groups within this realm with search in the name- Parameters:
search- Case insensitive string which will be searched for. Ignored if null.first- Index of first group to return. Ignored if negative ornull.max- Maximum number of records to return. Ignored if negative ornull.- Returns:
- Stream of desired groups. Never returns
null.
-
getGroupsCount
default long getGroupsCount() -
getGroupsCountByNameContaining
-
joinGroup
-
joinGroup
-
leaveGroup
-
isMemberOf
-
getFederationLink
String getFederationLink() -
setFederationLink
-
getServiceAccountClientLink
String getServiceAccountClientLink() -
setServiceAccountClientLink
-
isFederated
default boolean isFederated()Indicates if thisUserModelmaps to a local account or an account federated from an external user storage.- Returns:
trueif a federated account. Otherwise,false.
-
credentialManager
SubjectCredentialManager credentialManager()Instance of a user credential manager to validate and update the credentials of this user.
-