public abstract class AbstractUserAdapter extends UserModelDefaultMethods
Modifier and Type | Class and Description |
---|---|
static class |
AbstractUserAdapter.Streams
The
AbstractUserAdapter.Streams class extends the AbstractUserAdapter abstract class and implements
the UserModel.Streams interface, allowing subclasses to focus on the implementation of the Stream -based
query methods and providing default implementations for the collections-based variants that delegate to their
Stream counterparts. |
UserModel.RequiredAction, UserModel.SearchableFields, UserModel.UserRemovedEvent
Modifier and Type | Field and Description |
---|---|
protected long |
created |
protected RealmModel |
realm |
protected KeycloakSession |
session |
protected StorageId |
storageId |
protected ComponentModel |
storageProviderModel |
COMPARE_BY_USERNAME, DISABLED_REASON, EMAIL, EMAIL_VERIFIED, ENABLED, EXACT, FIRST_NAME, GROUPS, IDP_ALIAS, IDP_USER_ID, INCLUDE_SERVICE_ACCOUNT, LAST_NAME, LOCALE, SEARCH, USERNAME
Constructor and Description |
---|
AbstractUserAdapter(KeycloakSession session,
RealmModel realm,
ComponentModel storageProviderModel) |
Modifier and Type | Method and Description |
---|---|
void |
addRequiredAction(String action) |
void |
addRequiredAction(UserModel.RequiredAction action) |
protected boolean |
appendDefaultGroups()
Should the realm's default groups be appended to getGroups() call?
If your storage provider is not managing group mappings then it is recommended that
this method return true
|
protected boolean |
appendDefaultRolesToRoleMappings()
Should the realm's default roles be appended to getRoleMappings() call?
If your storage provider is not managing all role mappings then it is recommended that
this method return true
|
void |
deleteRoleMapping(RoleModel role)
Removes the given role mapping from this object.
|
boolean |
equals(Object o) |
List<String> |
getAttribute(String name) |
Map<String,List<String>> |
getAttributes() |
Set<RoleModel> |
getClientRoleMappings(ClientModel app)
Returns set of client roles that are directly set to this object for the given client.
|
Long |
getCreatedTimestamp()
Get timestamp of user creation.
|
String |
getEmail() |
String |
getFederationLink()
This method should not be overriden
|
String |
getFirstAttribute(String name) |
String |
getFirstName() |
Set<GroupModel> |
getGroups() |
protected Set<GroupModel> |
getGroupsInternal()
Get group membership mappings that are managed by this storage provider
|
String |
getId()
Defaults to 'f:' + storageProvider.getId() + ':' + getUsername()
|
String |
getLastName() |
Set<RoleModel> |
getRealmRoleMappings()
Returns set of realm roles that are directly set to this object.
|
Set<String> |
getRequiredActions() |
Set<RoleModel> |
getRoleMappings()
Returns set of all role (both realm all client) that are directly set to this object.
|
protected Set<RoleModel> |
getRoleMappingsInternal() |
String |
getServiceAccountClientLink()
This method should not be overriden
|
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. |
boolean |
isEmailVerified() |
boolean |
isEnabled() |
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)
This method should not be overriden
|
void |
setFirstName(String firstName) |
void |
setLastName(String lastName) |
void |
setServiceAccountClientLink(String clientInternalId)
This method should not be overriden
|
void |
setSingleAttribute(String name,
String value)
Set single value of specified attribute.
|
void |
setUsername(String username)
Sets username for this user.
|
toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getAttributeStream, getGroups, getGroups, getGroupsCount, getGroupsCountByNameContaining, getGroupsStream, getGroupsStream, getRequiredActionsStream, getUsername
getClientRoleMappingsStream, getRealmRoleMappingsStream, getRoleMappingsStream
protected KeycloakSession session
protected RealmModel realm
protected ComponentModel storageProviderModel
protected StorageId storageId
protected long created
public AbstractUserAdapter(KeycloakSession session, RealmModel realm, ComponentModel storageProviderModel)
public void addRequiredAction(String action)
public void removeRequiredAction(String action)
public void addRequiredAction(UserModel.RequiredAction action)
public void removeRequiredAction(UserModel.RequiredAction action)
protected Set<GroupModel> getGroupsInternal()
protected boolean appendDefaultGroups()
public Set<GroupModel> getGroups()
public void joinGroup(GroupModel group)
public void leaveGroup(GroupModel group)
public boolean isMemberOf(GroupModel group)
public Set<RoleModel> getRealmRoleMappings()
RoleMapperModel
public Set<RoleModel> getClientRoleMappings(ClientModel app)
RoleMapperModel
app
- Client to get the roles forpublic boolean hasRole(RoleModel role)
RoleMapperModel
true
if this object is directly or indirectly assigned the given role, false
otherwise.
For example, true
is returned for hasRole(R) if:
public void grantRole(RoleModel role)
RoleMapperModel
protected boolean appendDefaultRolesToRoleMappings()
public Set<RoleModel> getRoleMappings()
RoleMapperModel
public void deleteRoleMapping(RoleModel role)
RoleMapperModel
role
- Role to removepublic boolean isEnabled()
public void setEnabled(boolean enabled)
public String getFederationLink()
public void setFederationLink(String link)
public String getServiceAccountClientLink()
public void setServiceAccountClientLink(String clientInternalId)
public String getId()
public void setUsername(String username)
UserModel
username
- username stringpublic Long getCreatedTimestamp()
UserModel
public void setCreatedTimestamp(Long timestamp)
public void setSingleAttribute(String name, String value)
UserModel
public void removeAttribute(String name)
public String getFirstAttribute(String name)
public List<String> getAttribute(String name)
public String getFirstName()
getFirstName
in interface UserModel
getFirstName
in class UserModelDefaultMethods
public void setFirstName(String firstName)
setFirstName
in interface UserModel
setFirstName
in class UserModelDefaultMethods
public String getLastName()
getLastName
in interface UserModel
getLastName
in class UserModelDefaultMethods
public void setLastName(String lastName)
setLastName
in interface UserModel
setLastName
in class UserModelDefaultMethods
public String getEmail()
getEmail
in interface UserModel
getEmail
in class UserModelDefaultMethods
public void setEmail(String email)
UserModel
setEmail
in interface UserModel
setEmail
in class UserModelDefaultMethods
email
- the emailpublic boolean isEmailVerified()
public void setEmailVerified(boolean verified)
Copyright © 2021 JBoss by Red Hat. All rights reserved.