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
,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
Modifier and TypeInterfaceDescriptionstatic enum
static interface
static interface
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Comparator<UserModel>
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
static final String
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addRequiredAction
(String action) default void
Instance 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 long
default long
getGroupsCountByNameContaining
(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.boolean
boolean
default boolean
Indicates if thisUserModel
maps to a local account or an account federated from an external user storage.boolean
isMemberOf
(GroupModel group) void
joinGroup
(GroupModel group) default void
joinGroup
(GroupModel group, MembershipMetadata metadata) void
leaveGroup
(GroupModel group) void
removeAttribute
(String name) void
removeRequiredAction
(String action) default void
void
setAttribute
(String name, List<String> values) void
setCreatedTimestamp
(Long timestamp) void
Sets email for this user.void
setEmailVerified
(boolean verified) void
setEnabled
(boolean enabled) void
setFederationLink
(String link) void
setFirstName
(String firstName) void
setLastName
(String lastName) void
setServiceAccountClientLink
(String clientInternalId) void
setSingleAttribute
(String name, String value) Set single value of specified attribute.void
setUsername
(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
Stream
of attribute values.
-
getAttributes
-
getRequiredActionsStream
Obtains the aliases of required actions associated with the user.- Returns:
- a non-null
Stream
of 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
Stream
of 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 thisUserModel
maps to a local account or an account federated from an external user storage.- Returns:
true
if a federated account. Otherwise,false
.
-
credentialManager
SubjectCredentialManager credentialManager()Instance of a user credential manager to validate and update the credentials of this user.
-