public class JpaUserFederatedStorageProvider extends Object implements UserFederatedStorageProvider.Streams, UserCredentialStore.Streams
UserFederatedStorageProvider.Streams
UserCredentialStore.Streams
Modifier and Type | Field and Description |
---|---|
protected javax.persistence.EntityManager |
em |
protected static org.jboss.logging.Logger |
logger |
Constructor and Description |
---|
JpaUserFederatedStorageProvider(KeycloakSession session,
javax.persistence.EntityManager em) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getStoredUsers
getUsersByUserAttribute
getFederatedIdentities
getConsents
getStoredCredentials, getStoredCredentialsByType
getGroups, getMembership
getRequiredActions
getRoleMappings
getStoredCredentials, getStoredCredentialsByType
protected static final org.jboss.logging.Logger logger
protected javax.persistence.EntityManager em
public JpaUserFederatedStorageProvider(KeycloakSession session, javax.persistence.EntityManager em)
protected void createIndex(RealmModel realm, String userId)
public void setAttribute(RealmModel realm, String userId, String name, List<String> values)
setAttribute
in interface UserAttributeFederatedStorage
public void setSingleAttribute(RealmModel realm, String userId, String name, String value)
setSingleAttribute
in interface UserAttributeFederatedStorage
public void removeAttribute(RealmModel realm, String userId, String name)
removeAttribute
in interface UserAttributeFederatedStorage
public MultivaluedHashMap<String,String> getAttributes(RealmModel realm, String userId)
getAttributes
in interface UserAttributeFederatedStorage
public Stream<String> getUsersByUserAttributeStream(RealmModel realm, String name, String value)
UserAttributeFederatedStorage
name
and value
.getUsersByUserAttributeStream
in interface UserAttributeFederatedStorage
getUsersByUserAttributeStream
in interface UserAttributeFederatedStorage.Streams
realm
- a reference to the realm.name
- the attribute name.value
- the attribute value.Stream
of users that match the search criteria.public String getUserByFederatedIdentity(FederatedIdentityModel link, RealmModel realm)
getUserByFederatedIdentity
in interface UserBrokerLinkFederatedStorage
public void addFederatedIdentity(RealmModel realm, String userId, FederatedIdentityModel link)
addFederatedIdentity
in interface UserBrokerLinkFederatedStorage
public boolean removeFederatedIdentity(RealmModel realm, String userId, String socialProvider)
removeFederatedIdentity
in interface UserBrokerLinkFederatedStorage
public void preRemove(RealmModel realm, IdentityProviderModel provider)
preRemove
in interface UserBrokerLinkFederatedStorage
public void updateFederatedIdentity(RealmModel realm, String userId, FederatedIdentityModel model)
updateFederatedIdentity
in interface UserBrokerLinkFederatedStorage
public Stream<FederatedIdentityModel> getFederatedIdentitiesStream(String userId, RealmModel realm)
UserBrokerLinkFederatedStorage
userId
.getFederatedIdentitiesStream
in interface UserBrokerLinkFederatedStorage
getFederatedIdentitiesStream
in interface UserBrokerLinkFederatedStorage.Streams
userId
- the user identifier.realm
- a reference to the realm.Stream
of federated identities associated with the user.public FederatedIdentityModel getFederatedIdentity(String userId, String socialProvider, RealmModel realm)
getFederatedIdentity
in interface UserBrokerLinkFederatedStorage
public void addConsent(RealmModel realm, String userId, UserConsentModel consent)
addConsent
in interface UserConsentFederatedStorage
public UserConsentModel getConsentByClient(RealmModel realm, String userId, String clientInternalId)
getConsentByClient
in interface UserConsentFederatedStorage
public Stream<UserConsentModel> getConsentsStream(RealmModel realm, String userId)
UserConsentFederatedStorage
userId
.getConsentsStream
in interface UserConsentFederatedStorage
getConsentsStream
in interface UserConsentFederatedStorage.Streams
realm
- a reference to the realm.userId
- the user identifier.Stream
of consents associated with the user.public void updateConsent(RealmModel realm, String userId, UserConsentModel consent)
updateConsent
in interface UserConsentFederatedStorage
public boolean revokeConsentForClient(RealmModel realm, String userId, String clientInternalId)
revokeConsentForClient
in interface UserConsentFederatedStorage
public void setNotBeforeForUser(RealmModel realm, String userId, int notBefore)
setNotBeforeForUser
in interface UserNotBeforeFederatedStorage
public int getNotBeforeOfUser(RealmModel realm, String userId)
getNotBeforeOfUser
in interface UserNotBeforeFederatedStorage
public Stream<GroupModel> getGroupsStream(RealmModel realm, String userId)
UserGroupMembershipFederatedStorage
getGroupsStream
in interface UserGroupMembershipFederatedStorage
getGroupsStream
in interface UserGroupMembershipFederatedStorage.Streams
realm
- a reference to the realm.userId
- the user identifier.Stream
of groups.public void joinGroup(RealmModel realm, String userId, GroupModel group)
joinGroup
in interface UserGroupMembershipFederatedStorage
public void leaveGroup(RealmModel realm, String userId, GroupModel group)
leaveGroup
in interface UserGroupMembershipFederatedStorage
public Stream<String> getMembershipStream(RealmModel realm, GroupModel group, Integer firstResult, Integer max)
UserGroupMembershipFederatedStorage
group
in the specified realm
.getMembershipStream
in interface UserGroupMembershipFederatedStorage
getMembershipStream
in interface UserGroupMembershipFederatedStorage.Streams
realm
- a reference to the realm.group
- a reference to the group whose federated members are being searched.firstResult
- first result to return. Ignored if negative or null
.max
- maximum number of results to return. Ignored if negative or null
.Stream
of federated user ids that are members of the group in the realm.public Stream<String> getRequiredActionsStream(RealmModel realm, String userId)
UserRequiredActionsFederatedStorage
userId
.getRequiredActionsStream
in interface UserRequiredActionsFederatedStorage
getRequiredActionsStream
in interface UserRequiredActionsFederatedStorage.Streams
realm
- a reference to the realm.userId
- the user identifier.Stream
of required action names.public void addRequiredAction(RealmModel realm, String userId, String action)
addRequiredAction
in interface UserRequiredActionsFederatedStorage
public void removeRequiredAction(RealmModel realm, String userId, String action)
removeRequiredAction
in interface UserRequiredActionsFederatedStorage
public void grantRole(RealmModel realm, String userId, RoleModel role)
grantRole
in interface UserRoleMappingsFederatedStorage
public Stream<RoleModel> getRoleMappingsStream(RealmModel realm, String userId)
UserRoleMappingsFederatedStorage
userId
.getRoleMappingsStream
in interface UserRoleMappingsFederatedStorage
getRoleMappingsStream
in interface UserRoleMappingsFederatedStorage.Streams
realm
- a reference to the realm.userId
- the user identifier.Stream
of roles.public void deleteRoleMapping(RealmModel realm, String userId, RoleModel role)
deleteRoleMapping
in interface UserRoleMappingsFederatedStorage
public void updateCredential(RealmModel realm, String userId, CredentialModel cred)
updateCredential
in interface UserFederatedUserCredentialStore
public CredentialModel createCredential(RealmModel realm, String userId, CredentialModel cred)
createCredential
in interface UserFederatedUserCredentialStore
public boolean removeStoredCredential(RealmModel realm, String userId, String id)
removeStoredCredential
in interface UserFederatedUserCredentialStore
public CredentialModel getStoredCredentialById(RealmModel realm, String userId, String id)
getStoredCredentialById
in interface UserFederatedUserCredentialStore
protected CredentialModel toModel(FederatedUserCredentialEntity entity)
public Stream<CredentialModel> getStoredCredentialsStream(RealmModel realm, String userId)
UserFederatedUserCredentialStore
userId
.getStoredCredentialsStream
in interface UserFederatedUserCredentialStore
getStoredCredentialsStream
in interface UserFederatedUserCredentialStore.Streams
realm
- a reference to the realm.userId
- the user identifier.Stream
of credentials.public Stream<CredentialModel> getStoredCredentialsByTypeStream(RealmModel realm, String userId, String type)
UserFederatedUserCredentialStore
type
that are associated with the federated user identified by userId
.getStoredCredentialsByTypeStream
in interface UserFederatedUserCredentialStore
getStoredCredentialsByTypeStream
in interface UserFederatedUserCredentialStore.Streams
realm
- a reference to the realm.userId
- the user identifier.type
- the credential type.Stream
of credentials.public CredentialModel getStoredCredentialByNameAndType(RealmModel realm, String userId, String name, String type)
getStoredCredentialByNameAndType
in interface UserFederatedUserCredentialStore
public Stream<String> getStoredUsersStream(RealmModel realm, Integer first, Integer max)
UserFederatedStorageProvider
getStoredUsersStream
in interface UserFederatedStorageProvider
getStoredUsersStream
in interface UserFederatedStorageProvider.Streams
realm
- a reference to the realm.first
- first result to return. Ignored if negative or null
.max
- maximum number of results to return. Ignored if negative or null
.Stream
of federated user ids.public void updateCredential(RealmModel realm, UserModel user, CredentialModel cred)
updateCredential
in interface UserCredentialStore
public CredentialModel createCredential(RealmModel realm, UserModel user, CredentialModel cred)
createCredential
in interface UserCredentialStore
public boolean removeStoredCredential(RealmModel realm, UserModel user, String id)
removeStoredCredential
in interface UserCredentialStore
public CredentialModel getStoredCredentialById(RealmModel realm, UserModel user, String id)
getStoredCredentialById
in interface UserCredentialStore
public Stream<CredentialModel> getStoredCredentialsStream(RealmModel realm, UserModel user)
UserCredentialStore
getStoredCredentialsStream
in interface UserCredentialStore
getStoredCredentialsStream
in interface UserCredentialStore.Streams
realm
- a reference to the realm.user
- the user whose credentials are being searched.Stream
of credentials.public Stream<CredentialModel> getStoredCredentialsByTypeStream(RealmModel realm, UserModel user, String type)
UserCredentialStore
getStoredCredentialsByTypeStream
in interface UserCredentialStore
getStoredCredentialsByTypeStream
in interface UserCredentialStore.Streams
realm
- a reference to the realm.user
- the user whose credentials are being searched.type
- the type of credentials being searched.Stream
of credentials.public CredentialModel getStoredCredentialByNameAndType(RealmModel realm, UserModel user, String name, String type)
getStoredCredentialByNameAndType
in interface UserCredentialStore
public boolean moveCredentialTo(RealmModel realm, UserModel user, String id, String newPreviousCredentialId)
moveCredentialTo
in interface UserCredentialStore
public int getStoredUsersCount(RealmModel realm)
getStoredUsersCount
in interface UserFederatedStorageProvider
public void preRemove(RealmModel realm)
preRemove
in interface UserFederatedStorageProvider
public void preRemove(RealmModel realm, RoleModel role)
preRemove
in interface UserFederatedStorageProvider
public void preRemove(RealmModel realm, GroupModel group)
preRemove
in interface UserFederatedStorageProvider
public void preRemove(RealmModel realm, ClientModel client)
preRemove
in interface UserFederatedStorageProvider
public void preRemove(ProtocolMapperModel protocolMapper)
preRemove
in interface UserFederatedStorageProvider
public void preRemove(ClientScopeModel clientScope)
preRemove
in interface UserFederatedStorageProvider
public void preRemove(RealmModel realm, UserModel user)
preRemove
in interface UserFederatedStorageProvider
public void preRemove(RealmModel realm, ComponentModel model)
preRemove
in interface UserFederatedStorageProvider
Copyright © 2021 JBoss by Red Hat. All rights reserved.