public abstract class MapUserAdapter<K> extends AbstractUserModel<MapUserEntity<K>>
UserModel.RequiredAction, UserModel.SearchableFields, UserModel.Streams, UserModel.UserRemovedEvent
entity, realm, session
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 |
---|
MapUserAdapter(KeycloakSession session,
RealmModel realm,
MapUserEntity<K> entity) |
Modifier and Type | Method and Description |
---|---|
void |
addRequiredAction(String action) |
abstract boolean |
checkEmailUniqueness(RealmModel realm,
String email) |
abstract boolean |
checkUsernameUniqueness(RealmModel realm,
String username) |
void |
deleteRoleMapping(RoleModel role)
Removes the given role mapping from this object.
|
Map<String,List<String>> |
getAttributes() |
Stream<String> |
getAttributeStream(String name)
Obtains all values associated with the specified attribute name.
|
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.
|
String |
getEmail() |
String |
getFederationLink() |
String |
getFirstAttribute(String name) |
String |
getFirstName() |
Stream<GroupModel> |
getGroupsStream()
Obtains the groups associated with the user.
|
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.
|
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 |
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.
|
String |
toString() |
equals, hashCode
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getAttribute, getGroups, getRequiredActions
addRequiredAction, getGroups, getGroups, getGroupsCount, getGroupsCountByNameContaining, getGroupsStream, getId, removeRequiredAction
getClientRoleMappings, getRealmRoleMappings, getRoleMappings
public MapUserAdapter(KeycloakSession session, RealmModel realm, MapUserEntity<K> entity)
public String getUsername()
public void setUsername(String username)
UserModel
username
- username stringpublic Long getCreatedTimestamp()
UserModel
public void setCreatedTimestamp(Long timestamp)
public boolean isEnabled()
public void setEnabled(boolean enabled)
public void setSingleAttribute(String name, String value)
UserModel
public void removeAttribute(String name)
public String getFirstAttribute(String name)
public Stream<String> getAttributeStream(String name)
UserModel
name
- the name of the attribute.Stream
of attribute values.public Stream<String> getRequiredActionsStream()
UserModel
Stream
of required action names.public void addRequiredAction(String action)
public void removeRequiredAction(String action)
public String getFirstName()
public void setFirstName(String firstName)
public String getLastName()
public void setLastName(String lastName)
public String getEmail()
public void setEmail(String email)
UserModel
email
- the emailpublic abstract boolean checkEmailUniqueness(RealmModel realm, String email)
public abstract boolean checkUsernameUniqueness(RealmModel realm, String username)
public boolean isEmailVerified()
public void setEmailVerified(boolean verified)
public Stream<GroupModel> getGroupsStream()
UserModel
Stream
of groups.public void joinGroup(GroupModel group)
public void leaveGroup(GroupModel group)
public boolean isMemberOf(GroupModel group)
public String getFederationLink()
public void setFederationLink(String link)
public String getServiceAccountClientLink()
public void setServiceAccountClientLink(String clientInternalId)
public Stream<RoleModel> getRealmRoleMappingsStream()
RoleMapperModel
RoleModel
. Never returns null
.public Stream<RoleModel> getClientRoleMappingsStream(ClientModel app)
RoleMapperModel
app
- ClientModel
Client to get the roles for.RoleModel
. Never returns null
.public 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
public Stream<RoleModel> getRoleMappingsStream()
RoleMapperModel
RoleModel
. Never returns null
.public void deleteRoleMapping(RoleModel role)
RoleMapperModel
role
- Role to removeCopyright © 2021 JBoss by Red Hat. All rights reserved.