public class UserAdapter extends Object implements UserModel, JpaModel<UserEntity>
UserModel.RequiredAction, UserModel.UserRemovedEvent
Modifier and Type | Field and Description |
---|---|
protected javax.persistence.EntityManager |
em |
protected RealmModel |
realm |
protected UserEntity |
user |
Constructor and Description |
---|
UserAdapter(KeycloakSession session,
RealmModel realm,
javax.persistence.EntityManager em,
UserEntity user) |
Modifier and Type | Method and Description |
---|---|
void |
addRequiredAction(String actionName) |
void |
addRequiredAction(UserModel.RequiredAction action) |
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() |
UserEntity |
getEntity() |
String |
getFederationLink() |
String |
getFirstAttribute(String name) |
String |
getFirstName() |
Set<GroupModel> |
getGroups() |
Set<GroupModel> |
getGroups(String search,
int first,
int max) |
long |
getGroupsCount() |
long |
getGroupsCountByNameContaining(String search) |
String |
getId() |
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.
|
String |
getServiceAccountClientLink() |
protected javax.persistence.TypedQuery<UserGroupMembershipEntity> |
getUserGroupMappingQuery(GroupModel group) |
String |
getUsername() |
protected javax.persistence.TypedQuery<UserRoleMappingEntity> |
getUserRoleMappingEntityTypedQuery(RoleModel role) |
void |
grantRole(RoleModel role)
Grants the given role to this object.
|
void |
grantRoleImpl(RoleModel role) |
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) |
protected void |
joinGroupImpl(GroupModel group) |
void |
leaveGroup(GroupModel group) |
void |
removeAttribute(String name) |
void |
removeRequiredAction(String actionName) |
void |
removeRequiredAction(UserModel.RequiredAction action) |
void |
setAttribute(String name,
List<String> values) |
void |
setCreatedTimestamp(Long timestamp) |
void |
setEmail(String email) |
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) |
protected UserEntity user
protected javax.persistence.EntityManager em
protected RealmModel realm
public UserAdapter(KeycloakSession session, RealmModel realm, javax.persistence.EntityManager em, UserEntity user)
public UserEntity getEntity()
getEntity
in interface JpaModel<UserEntity>
public String getUsername()
getUsername
in interface UserModel
public void setUsername(String username)
setUsername
in interface UserModel
public Long getCreatedTimestamp()
UserModel
getCreatedTimestamp
in interface UserModel
public void setCreatedTimestamp(Long timestamp)
setCreatedTimestamp
in interface UserModel
public void setEnabled(boolean enabled)
setEnabled
in interface UserModel
public void setSingleAttribute(String name, String value)
UserModel
setSingleAttribute
in interface UserModel
public void setAttribute(String name, List<String> values)
setAttribute
in interface UserModel
public void removeAttribute(String name)
removeAttribute
in interface UserModel
public String getFirstAttribute(String name)
getFirstAttribute
in interface UserModel
public List<String> getAttribute(String name)
getAttribute
in interface UserModel
public Map<String,List<String>> getAttributes()
getAttributes
in interface UserModel
public Set<String> getRequiredActions()
getRequiredActions
in interface UserModel
public void addRequiredAction(UserModel.RequiredAction action)
addRequiredAction
in interface UserModel
public void addRequiredAction(String actionName)
addRequiredAction
in interface UserModel
public void removeRequiredAction(UserModel.RequiredAction action)
removeRequiredAction
in interface UserModel
public void removeRequiredAction(String actionName)
removeRequiredAction
in interface UserModel
public String getFirstName()
getFirstName
in interface UserModel
public void setFirstName(String firstName)
setFirstName
in interface UserModel
public String getLastName()
getLastName
in interface UserModel
public void setLastName(String lastName)
setLastName
in interface UserModel
public boolean isEmailVerified()
isEmailVerified
in interface UserModel
public void setEmailVerified(boolean verified)
setEmailVerified
in interface UserModel
public Set<GroupModel> getGroups()
public Set<GroupModel> getGroups(String search, int first, int max)
public long getGroupsCount()
getGroupsCount
in interface UserModel
public long getGroupsCountByNameContaining(String search)
getGroupsCountByNameContaining
in interface UserModel
public void joinGroup(GroupModel group)
protected void joinGroupImpl(GroupModel group)
public void leaveGroup(GroupModel group)
leaveGroup
in interface UserModel
public boolean isMemberOf(GroupModel group)
isMemberOf
in interface UserModel
protected javax.persistence.TypedQuery<UserGroupMembershipEntity> getUserGroupMappingQuery(GroupModel group)
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:
hasRole
in interface RoleMapperModel
protected javax.persistence.TypedQuery<UserRoleMappingEntity> getUserRoleMappingEntityTypedQuery(RoleModel role)
public void grantRole(RoleModel role)
RoleMapperModel
grantRole
in interface RoleMapperModel
public void grantRoleImpl(RoleModel role)
public Set<RoleModel> getRealmRoleMappings()
RoleMapperModel
getRealmRoleMappings
in interface RoleMapperModel
public Set<RoleModel> getRoleMappings()
RoleMapperModel
getRoleMappings
in interface RoleMapperModel
public void deleteRoleMapping(RoleModel role)
RoleMapperModel
deleteRoleMapping
in interface RoleMapperModel
role
- Role to removepublic Set<RoleModel> getClientRoleMappings(ClientModel app)
RoleMapperModel
getClientRoleMappings
in interface RoleMapperModel
app
- Client to get the roles forpublic String getFederationLink()
getFederationLink
in interface UserModel
public void setFederationLink(String link)
setFederationLink
in interface UserModel
public String getServiceAccountClientLink()
getServiceAccountClientLink
in interface UserModel
public void setServiceAccountClientLink(String clientInternalId)
setServiceAccountClientLink
in interface UserModel
Copyright © 2020 JBoss by Red Hat. All rights reserved.