Package org.keycloak.models.jpa
Class UserAdapter
- java.lang.Object
-
- org.keycloak.models.jpa.UserAdapter
-
- All Implemented Interfaces:
JpaModel<UserEntity>
,RoleMapperModel
,RoleMapperModel.Streams
,UserModel
,UserModel.Streams
public class UserAdapter extends Object implements UserModel.Streams, JpaModel<UserEntity>
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.keycloak.models.RoleMapperModel
RoleMapperModel.Streams
-
Nested classes/interfaces inherited from interface org.keycloak.models.UserModel
UserModel.RequiredAction, UserModel.SearchableFields, UserModel.Streams, UserModel.UserRemovedEvent
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.persistence.EntityManager
em
protected RealmModel
realm
protected UserEntity
user
-
Fields inherited from interface org.keycloak.models.UserModel
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 Summary
Constructors Constructor Description UserAdapter(KeycloakSession session, RealmModel realm, javax.persistence.EntityManager em, UserEntity user)
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.keycloak.models.RoleMapperModel
hasDirectRole
-
Methods inherited from interface org.keycloak.models.RoleMapperModel.Streams
getClientRoleMappings, getRealmRoleMappings, getRoleMappings
-
Methods inherited from interface org.keycloak.models.UserModel
addRequiredAction, getGroups, getGroups, removeRequiredAction
-
Methods inherited from interface org.keycloak.models.UserModel.Streams
getAttribute, getGroups, getRequiredActions
-
-
-
-
Field Detail
-
user
protected UserEntity user
-
em
protected javax.persistence.EntityManager em
-
realm
protected RealmModel realm
-
-
Constructor Detail
-
UserAdapter
public UserAdapter(KeycloakSession session, RealmModel realm, javax.persistence.EntityManager em, UserEntity user)
-
-
Method Detail
-
getEntity
public UserEntity getEntity()
- Specified by:
getEntity
in interfaceJpaModel<UserEntity>
-
getUsername
public String getUsername()
- Specified by:
getUsername
in interfaceUserModel
-
setUsername
public void setUsername(String username)
- Specified by:
setUsername
in interfaceUserModel
-
getCreatedTimestamp
public Long getCreatedTimestamp()
- Specified by:
getCreatedTimestamp
in interfaceUserModel
-
setCreatedTimestamp
public void setCreatedTimestamp(Long timestamp)
- Specified by:
setCreatedTimestamp
in interfaceUserModel
-
setEnabled
public void setEnabled(boolean enabled)
- Specified by:
setEnabled
in interfaceUserModel
-
setSingleAttribute
public void setSingleAttribute(String name, String value)
- Specified by:
setSingleAttribute
in interfaceUserModel
-
setAttribute
public void setAttribute(String name, List<String> values)
- Specified by:
setAttribute
in interfaceUserModel
-
removeAttribute
public void removeAttribute(String name)
- Specified by:
removeAttribute
in interfaceUserModel
-
getFirstAttribute
public String getFirstAttribute(String name)
- Specified by:
getFirstAttribute
in interfaceUserModel
-
getAttributeStream
public Stream<String> getAttributeStream(String name)
- Specified by:
getAttributeStream
in interfaceUserModel
- Specified by:
getAttributeStream
in interfaceUserModel.Streams
-
getAttributes
public Map<String,List<String>> getAttributes()
- Specified by:
getAttributes
in interfaceUserModel
-
getRequiredActionsStream
public Stream<String> getRequiredActionsStream()
- Specified by:
getRequiredActionsStream
in interfaceUserModel
- Specified by:
getRequiredActionsStream
in interfaceUserModel.Streams
-
addRequiredAction
public void addRequiredAction(String actionName)
- Specified by:
addRequiredAction
in interfaceUserModel
-
removeRequiredAction
public void removeRequiredAction(String actionName)
- Specified by:
removeRequiredAction
in interfaceUserModel
-
getFirstName
public String getFirstName()
- Specified by:
getFirstName
in interfaceUserModel
-
setFirstName
public void setFirstName(String firstName)
- Specified by:
setFirstName
in interfaceUserModel
-
getLastName
public String getLastName()
- Specified by:
getLastName
in interfaceUserModel
-
setLastName
public void setLastName(String lastName)
- Specified by:
setLastName
in interfaceUserModel
-
isEmailVerified
public boolean isEmailVerified()
- Specified by:
isEmailVerified
in interfaceUserModel
-
setEmailVerified
public void setEmailVerified(boolean verified)
- Specified by:
setEmailVerified
in interfaceUserModel
-
getGroupsStream
public Stream<GroupModel> getGroupsStream()
- Specified by:
getGroupsStream
in interfaceUserModel
- Specified by:
getGroupsStream
in interfaceUserModel.Streams
-
getGroupsStream
public Stream<GroupModel> getGroupsStream(String search, Integer first, Integer max)
- Specified by:
getGroupsStream
in interfaceUserModel
-
getGroupsCount
public long getGroupsCount()
- Specified by:
getGroupsCount
in interfaceUserModel
-
getGroupsCountByNameContaining
public long getGroupsCountByNameContaining(String search)
- Specified by:
getGroupsCountByNameContaining
in interfaceUserModel
-
joinGroup
public void joinGroup(GroupModel group)
-
joinGroupImpl
protected void joinGroupImpl(GroupModel group)
-
leaveGroup
public void leaveGroup(GroupModel group)
- Specified by:
leaveGroup
in interfaceUserModel
-
isMemberOf
public boolean isMemberOf(GroupModel group)
- Specified by:
isMemberOf
in interfaceUserModel
-
getUserGroupMappingQuery
protected javax.persistence.TypedQuery<UserGroupMembershipEntity> getUserGroupMappingQuery(GroupModel group)
-
hasRole
public boolean hasRole(RoleModel role)
- Specified by:
hasRole
in interfaceRoleMapperModel
-
getUserRoleMappingEntityTypedQuery
protected javax.persistence.TypedQuery<UserRoleMappingEntity> getUserRoleMappingEntityTypedQuery(RoleModel role)
-
grantRole
public void grantRole(RoleModel role)
- Specified by:
grantRole
in interfaceRoleMapperModel
-
grantRoleImpl
public void grantRoleImpl(RoleModel role)
-
getRealmRoleMappingsStream
public Stream<RoleModel> getRealmRoleMappingsStream()
- Specified by:
getRealmRoleMappingsStream
in interfaceRoleMapperModel
- Specified by:
getRealmRoleMappingsStream
in interfaceRoleMapperModel.Streams
-
getRoleMappingsStream
public Stream<RoleModel> getRoleMappingsStream()
- Specified by:
getRoleMappingsStream
in interfaceRoleMapperModel
- Specified by:
getRoleMappingsStream
in interfaceRoleMapperModel.Streams
-
deleteRoleMapping
public void deleteRoleMapping(RoleModel role)
- Specified by:
deleteRoleMapping
in interfaceRoleMapperModel
-
getClientRoleMappingsStream
public Stream<RoleModel> getClientRoleMappingsStream(ClientModel app)
- Specified by:
getClientRoleMappingsStream
in interfaceRoleMapperModel
- Specified by:
getClientRoleMappingsStream
in interfaceRoleMapperModel.Streams
-
getFederationLink
public String getFederationLink()
- Specified by:
getFederationLink
in interfaceUserModel
-
setFederationLink
public void setFederationLink(String link)
- Specified by:
setFederationLink
in interfaceUserModel
-
getServiceAccountClientLink
public String getServiceAccountClientLink()
- Specified by:
getServiceAccountClientLink
in interfaceUserModel
-
setServiceAccountClientLink
public void setServiceAccountClientLink(String clientInternalId)
- Specified by:
setServiceAccountClientLink
in interfaceUserModel
-
credentialManager
public SubjectCredentialManager credentialManager()
- Specified by:
credentialManager
in interfaceUserModel
-
-