public class UserAdapter extends Object implements CachedUserModel.Streams
CachedUserModel.StreamsUserModel.RequiredAction, UserModel.UserRemovedEvent| Modifier and Type | Field and Description |
|---|---|
protected CachedUser |
cached |
protected KeycloakSession |
keycloakSession |
protected RealmModel |
realm |
protected UserModel |
updated |
protected UserCacheSession |
userProviderCache |
COMPARE_BY_USERNAME, EMAIL, EMAIL_VERIFIED, ENABLED, EXACT, FIRST_NAME, GROUPS, IDP_ALIAS, IDP_USER_ID, INCLUDE_SERVICE_ACCOUNT, LAST_NAME, LOCALE, SEARCH, USERNAME| Constructor and Description |
|---|
UserAdapter(CachedUser cached,
UserCacheSession userProvider,
KeycloakSession keycloakSession,
RealmModel realm) |
| Modifier and Type | Method and Description |
|---|---|
void |
addRequiredAction(String action) |
void |
addRequiredAction(UserModel.RequiredAction action) |
void |
deleteRoleMapping(RoleModel role)
Removes the given role mapping from this object.
|
boolean |
equals(Object o) |
Map<String,List<String>> |
getAttributes() |
Stream<String> |
getAttributeStream(String name)
Obtains all values associated with the specified attribute name.
|
ConcurrentHashMap |
getCachedWith()
Returns a map that contains custom things that are cached along with this model.
|
long |
getCacheTimestamp()
When was the model was loaded from database.
|
Stream<RoleModel> |
getClientRoleMappingsStream(ClientModel app)
Returns stream of client roles that are directly set to this object for the given client.
|
Long |
getCreatedTimestamp()
Get timestamp of user creation.
|
UserModel |
getDelegateForUpdate()
Invalidates the cache for this user and returns a delegate that represents the actual data provider
|
String |
getEmail() |
String |
getFederationLink() |
String |
getFirstAttribute(String name) |
String |
getFirstName() |
long |
getGroupsCountByNameContaining(String search) |
Stream<GroupModel> |
getGroupsStream()
Obtains the groups associated with the user.
|
String |
getId() |
String |
getLastName() |
Stream<RoleModel> |
getRealmRoleMappingsStream()
Returns stream of realm roles that are directly set to this object.
|
Stream<String> |
getRequiredActionsStream()
Obtains the names of required actions associated with the user.
|
Stream<RoleModel> |
getRoleMappingsStream()
Returns stream of all role (both realm all client) that are directly set to this object.
|
String |
getServiceAccountClientLink() |
String |
getUsername() |
void |
grantRole(RoleModel role)
Grants the given role to this object.
|
int |
hashCode() |
boolean |
hasRole(RoleModel role)
Returns
true if this object is directly or indirectly assigned the given role, false otherwise. |
void |
invalidate()
Invalidate the cache for this model
|
boolean |
isEmailVerified() |
boolean |
isEnabled() |
boolean |
isMarkedForEviction() |
boolean |
isMemberOf(GroupModel group) |
void |
joinGroup(GroupModel group) |
void |
leaveGroup(GroupModel group) |
void |
removeAttribute(String name) |
void |
removeRequiredAction(String action) |
void |
removeRequiredAction(UserModel.RequiredAction action) |
void |
setAttribute(String name,
List<String> values) |
void |
setCreatedTimestamp(Long timestamp) |
void |
setEmail(String email)
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.
|
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetAttribute, getGroups, getRequiredActionsgetGroups, getGroups, getGroupsCount, getGroupsStreamgetClientRoleMappings, getRealmRoleMappings, getRoleMappingsprotected final CachedUser cached
protected final UserCacheSession userProviderCache
protected final KeycloakSession keycloakSession
protected final RealmModel realm
protected volatile UserModel updated
public UserAdapter(CachedUser cached, UserCacheSession userProvider, KeycloakSession keycloakSession, RealmModel realm)
public String getFirstName()
getFirstName in interface UserModelpublic void setFirstName(String firstName)
setFirstName in interface UserModelpublic String getLastName()
getLastName in interface UserModelpublic void setLastName(String lastName)
setLastName in interface UserModelpublic void setEmail(String email)
UserModelpublic UserModel getDelegateForUpdate()
CachedUserModelgetDelegateForUpdate in interface CachedUserModelpublic boolean isMarkedForEviction()
isMarkedForEviction in interface CachedUserModelpublic void invalidate()
CachedUserModelinvalidate in interface CachedUserModelpublic long getCacheTimestamp()
CachedUserModelgetCacheTimestamp in interface CachedUserModelpublic ConcurrentHashMap getCachedWith()
CachedUserModelgetCachedWith in interface CachedUserModelpublic String getUsername()
getUsername in interface UserModelpublic void setUsername(String username)
UserModelsetUsername in interface UserModelusername - username stringpublic Long getCreatedTimestamp()
UserModelgetCreatedTimestamp in interface UserModelpublic void setCreatedTimestamp(Long timestamp)
setCreatedTimestamp in interface UserModelpublic void setEnabled(boolean enabled)
setEnabled in interface UserModelpublic void setSingleAttribute(String name, String value)
UserModelsetSingleAttribute in interface UserModelpublic void setAttribute(String name, List<String> values)
setAttribute in interface UserModelpublic void removeAttribute(String name)
removeAttribute in interface UserModelpublic String getFirstAttribute(String name)
getFirstAttribute in interface UserModelpublic Stream<String> getAttributeStream(String name)
UserModelgetAttributeStream in interface UserModelgetAttributeStream in interface UserModel.Streamsname - the name of the attribute.Stream of attribute values.public Map<String,List<String>> getAttributes()
getAttributes in interface UserModelpublic Stream<String> getRequiredActionsStream()
UserModelgetRequiredActionsStream in interface UserModelgetRequiredActionsStream in interface UserModel.StreamsStream of required action names.public void addRequiredAction(UserModel.RequiredAction action)
addRequiredAction in interface UserModelpublic void removeRequiredAction(UserModel.RequiredAction action)
removeRequiredAction in interface UserModelpublic void addRequiredAction(String action)
addRequiredAction in interface UserModelpublic void removeRequiredAction(String action)
removeRequiredAction in interface UserModelpublic boolean isEmailVerified()
isEmailVerified in interface UserModelpublic void setEmailVerified(boolean verified)
setEmailVerified in interface UserModelpublic String getFederationLink()
getFederationLink in interface UserModelpublic void setFederationLink(String link)
setFederationLink in interface UserModelpublic String getServiceAccountClientLink()
getServiceAccountClientLink in interface UserModelpublic void setServiceAccountClientLink(String clientInternalId)
setServiceAccountClientLink in interface UserModelpublic Stream<RoleModel> getRealmRoleMappingsStream()
RoleMapperModelgetRealmRoleMappingsStream in interface RoleMapperModelgetRealmRoleMappingsStream in interface RoleMapperModel.StreamsRoleModelpublic Stream<RoleModel> getClientRoleMappingsStream(ClientModel app)
RoleMapperModelgetClientRoleMappingsStream in interface RoleMapperModelgetClientRoleMappingsStream in interface RoleMapperModel.Streamsapp - Client to get the roles forRoleModelpublic boolean hasRole(RoleModel role)
RoleMapperModeltrue if this object is directly or indirectly assigned the given role, false otherwise.
For example, true is returned for hasRole(R) if:
hasRole in interface RoleMapperModelpublic void grantRole(RoleModel role)
RoleMapperModelgrantRole in interface RoleMapperModelpublic Stream<RoleModel> getRoleMappingsStream()
RoleMapperModelgetRoleMappingsStream in interface RoleMapperModelgetRoleMappingsStream in interface RoleMapperModel.StreamsRoleModelpublic void deleteRoleMapping(RoleModel role)
RoleMapperModeldeleteRoleMapping in interface RoleMapperModelrole - Role to removepublic Stream<GroupModel> getGroupsStream()
UserModelgetGroupsStream in interface UserModelgetGroupsStream in interface UserModel.StreamsStream of groups.public long getGroupsCountByNameContaining(String search)
getGroupsCountByNameContaining in interface UserModelpublic void joinGroup(GroupModel group)
public void leaveGroup(GroupModel group)
leaveGroup in interface UserModelpublic boolean isMemberOf(GroupModel group)
isMemberOf in interface UserModelCopyright © 2021 JBoss by Red Hat. All rights reserved.