Package org.keycloak.storage.jpa
Class JpaUserFederatedStorageProvider
- java.lang.Object
-
- org.keycloak.storage.jpa.JpaUserFederatedStorageProvider
-
- All Implemented Interfaces:
UserCredentialStore
,UserCredentialStore.Streams
,Provider
,UserAttributeFederatedStorage
,UserAttributeFederatedStorage.Streams
,UserBrokerLinkFederatedStorage
,UserBrokerLinkFederatedStorage.Streams
,UserConsentFederatedStorage
,UserConsentFederatedStorage.Streams
,UserFederatedStorageProvider
,UserFederatedStorageProvider.Streams
,UserFederatedUserCredentialStore
,UserFederatedUserCredentialStore.Streams
,UserGroupMembershipFederatedStorage
,UserGroupMembershipFederatedStorage.Streams
,UserNotBeforeFederatedStorage
,UserRequiredActionsFederatedStorage
,UserRequiredActionsFederatedStorage.Streams
,UserRoleMappingsFederatedStorage
,UserRoleMappingsFederatedStorage.Streams
public class JpaUserFederatedStorageProvider extends Object implements UserFederatedStorageProvider.Streams, UserCredentialStore.Streams
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.keycloak.storage.federated.UserAttributeFederatedStorage
UserAttributeFederatedStorage.Streams
-
Nested classes/interfaces inherited from interface org.keycloak.storage.federated.UserBrokerLinkFederatedStorage
UserBrokerLinkFederatedStorage.Streams
-
Nested classes/interfaces inherited from interface org.keycloak.storage.federated.UserConsentFederatedStorage
UserConsentFederatedStorage.Streams
-
Nested classes/interfaces inherited from interface org.keycloak.credential.UserCredentialStore
UserCredentialStore.Streams
-
Nested classes/interfaces inherited from interface org.keycloak.storage.federated.UserFederatedStorageProvider
UserFederatedStorageProvider.Streams
-
Nested classes/interfaces inherited from interface org.keycloak.storage.federated.UserFederatedUserCredentialStore
UserFederatedUserCredentialStore.Streams
-
Nested classes/interfaces inherited from interface org.keycloak.storage.federated.UserGroupMembershipFederatedStorage
UserGroupMembershipFederatedStorage.Streams
-
Nested classes/interfaces inherited from interface org.keycloak.storage.federated.UserRequiredActionsFederatedStorage
UserRequiredActionsFederatedStorage.Streams
-
Nested classes/interfaces inherited from interface org.keycloak.storage.federated.UserRoleMappingsFederatedStorage
UserRoleMappingsFederatedStorage.Streams
-
-
Constructor Summary
Constructors Constructor Description JpaUserFederatedStorageProvider(KeycloakSession session, javax.persistence.EntityManager em)
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.keycloak.storage.federated.UserAttributeFederatedStorage.Streams
getUsersByUserAttribute
-
Methods inherited from interface org.keycloak.storage.federated.UserBrokerLinkFederatedStorage.Streams
getFederatedIdentities
-
Methods inherited from interface org.keycloak.storage.federated.UserConsentFederatedStorage.Streams
getConsents
-
Methods inherited from interface org.keycloak.credential.UserCredentialStore.Streams
getStoredCredentials, getStoredCredentialsByType
-
Methods inherited from interface org.keycloak.storage.federated.UserFederatedStorageProvider.Streams
getStoredUsers
-
Methods inherited from interface org.keycloak.storage.federated.UserFederatedUserCredentialStore.Streams
getStoredCredentials, getStoredCredentialsByType
-
Methods inherited from interface org.keycloak.storage.federated.UserGroupMembershipFederatedStorage.Streams
getGroups, getMembership
-
Methods inherited from interface org.keycloak.storage.federated.UserRequiredActionsFederatedStorage.Streams
getRequiredActions
-
Methods inherited from interface org.keycloak.storage.federated.UserRoleMappingsFederatedStorage.Streams
getRoleMappings
-
-
-
-
Constructor Detail
-
JpaUserFederatedStorageProvider
public JpaUserFederatedStorageProvider(KeycloakSession session, javax.persistence.EntityManager em)
-
-
Method Detail
-
createIndex
protected void createIndex(RealmModel realm, String userId)
We create an entry so that its easy to iterate over all things in the database. Specifically useful for export
-
setAttribute
public void setAttribute(RealmModel realm, String userId, String name, List<String> values)
- Specified by:
setAttribute
in interfaceUserAttributeFederatedStorage
-
setSingleAttribute
public void setSingleAttribute(RealmModel realm, String userId, String name, String value)
- Specified by:
setSingleAttribute
in interfaceUserAttributeFederatedStorage
-
removeAttribute
public void removeAttribute(RealmModel realm, String userId, String name)
- Specified by:
removeAttribute
in interfaceUserAttributeFederatedStorage
-
getAttributes
public MultivaluedHashMap<String,String> getAttributes(RealmModel realm, String userId)
- Specified by:
getAttributes
in interfaceUserAttributeFederatedStorage
-
getUsersByUserAttributeStream
public Stream<String> getUsersByUserAttributeStream(RealmModel realm, String name, String value)
- Specified by:
getUsersByUserAttributeStream
in interfaceUserAttributeFederatedStorage
- Specified by:
getUsersByUserAttributeStream
in interfaceUserAttributeFederatedStorage.Streams
-
getUserByFederatedIdentity
public String getUserByFederatedIdentity(FederatedIdentityModel link, RealmModel realm)
- Specified by:
getUserByFederatedIdentity
in interfaceUserBrokerLinkFederatedStorage
-
addFederatedIdentity
public void addFederatedIdentity(RealmModel realm, String userId, FederatedIdentityModel link)
- Specified by:
addFederatedIdentity
in interfaceUserBrokerLinkFederatedStorage
-
removeFederatedIdentity
public boolean removeFederatedIdentity(RealmModel realm, String userId, String socialProvider)
- Specified by:
removeFederatedIdentity
in interfaceUserBrokerLinkFederatedStorage
-
preRemove
public void preRemove(RealmModel realm, IdentityProviderModel provider)
- Specified by:
preRemove
in interfaceUserBrokerLinkFederatedStorage
-
updateFederatedIdentity
public void updateFederatedIdentity(RealmModel realm, String userId, FederatedIdentityModel model)
- Specified by:
updateFederatedIdentity
in interfaceUserBrokerLinkFederatedStorage
-
getFederatedIdentitiesStream
public Stream<FederatedIdentityModel> getFederatedIdentitiesStream(String userId, RealmModel realm)
- Specified by:
getFederatedIdentitiesStream
in interfaceUserBrokerLinkFederatedStorage
- Specified by:
getFederatedIdentitiesStream
in interfaceUserBrokerLinkFederatedStorage.Streams
-
getFederatedIdentity
public FederatedIdentityModel getFederatedIdentity(String userId, String socialProvider, RealmModel realm)
- Specified by:
getFederatedIdentity
in interfaceUserBrokerLinkFederatedStorage
-
addConsent
public void addConsent(RealmModel realm, String userId, UserConsentModel consent)
- Specified by:
addConsent
in interfaceUserConsentFederatedStorage
-
getConsentByClient
public UserConsentModel getConsentByClient(RealmModel realm, String userId, String clientInternalId)
- Specified by:
getConsentByClient
in interfaceUserConsentFederatedStorage
-
getConsentsStream
public Stream<UserConsentModel> getConsentsStream(RealmModel realm, String userId)
- Specified by:
getConsentsStream
in interfaceUserConsentFederatedStorage
- Specified by:
getConsentsStream
in interfaceUserConsentFederatedStorage.Streams
-
updateConsent
public void updateConsent(RealmModel realm, String userId, UserConsentModel consent)
- Specified by:
updateConsent
in interfaceUserConsentFederatedStorage
-
revokeConsentForClient
public boolean revokeConsentForClient(RealmModel realm, String userId, String clientInternalId)
- Specified by:
revokeConsentForClient
in interfaceUserConsentFederatedStorage
-
setNotBeforeForUser
public void setNotBeforeForUser(RealmModel realm, String userId, int notBefore)
- Specified by:
setNotBeforeForUser
in interfaceUserNotBeforeFederatedStorage
-
getNotBeforeOfUser
public int getNotBeforeOfUser(RealmModel realm, String userId)
- Specified by:
getNotBeforeOfUser
in interfaceUserNotBeforeFederatedStorage
-
getGroupsStream
public Stream<GroupModel> getGroupsStream(RealmModel realm, String userId)
- Specified by:
getGroupsStream
in interfaceUserGroupMembershipFederatedStorage
- Specified by:
getGroupsStream
in interfaceUserGroupMembershipFederatedStorage.Streams
-
joinGroup
public void joinGroup(RealmModel realm, String userId, GroupModel group)
- Specified by:
joinGroup
in interfaceUserGroupMembershipFederatedStorage
-
leaveGroup
public void leaveGroup(RealmModel realm, String userId, GroupModel group)
- Specified by:
leaveGroup
in interfaceUserGroupMembershipFederatedStorage
-
getMembershipStream
public Stream<String> getMembershipStream(RealmModel realm, GroupModel group, Integer firstResult, Integer max)
- Specified by:
getMembershipStream
in interfaceUserGroupMembershipFederatedStorage
- Specified by:
getMembershipStream
in interfaceUserGroupMembershipFederatedStorage.Streams
-
getRequiredActionsStream
public Stream<String> getRequiredActionsStream(RealmModel realm, String userId)
- Specified by:
getRequiredActionsStream
in interfaceUserRequiredActionsFederatedStorage
- Specified by:
getRequiredActionsStream
in interfaceUserRequiredActionsFederatedStorage.Streams
-
addRequiredAction
public void addRequiredAction(RealmModel realm, String userId, String action)
- Specified by:
addRequiredAction
in interfaceUserRequiredActionsFederatedStorage
-
removeRequiredAction
public void removeRequiredAction(RealmModel realm, String userId, String action)
- Specified by:
removeRequiredAction
in interfaceUserRequiredActionsFederatedStorage
-
grantRole
public void grantRole(RealmModel realm, String userId, RoleModel role)
- Specified by:
grantRole
in interfaceUserRoleMappingsFederatedStorage
-
getRoleMappingsStream
public Stream<RoleModel> getRoleMappingsStream(RealmModel realm, String userId)
- Specified by:
getRoleMappingsStream
in interfaceUserRoleMappingsFederatedStorage
- Specified by:
getRoleMappingsStream
in interfaceUserRoleMappingsFederatedStorage.Streams
-
deleteRoleMapping
public void deleteRoleMapping(RealmModel realm, String userId, RoleModel role)
- Specified by:
deleteRoleMapping
in interfaceUserRoleMappingsFederatedStorage
-
updateCredential
public void updateCredential(RealmModel realm, String userId, CredentialModel cred)
- Specified by:
updateCredential
in interfaceUserFederatedUserCredentialStore
-
createCredential
public CredentialModel createCredential(RealmModel realm, String userId, CredentialModel cred)
- Specified by:
createCredential
in interfaceUserFederatedUserCredentialStore
-
removeStoredCredential
public boolean removeStoredCredential(RealmModel realm, String userId, String id)
- Specified by:
removeStoredCredential
in interfaceUserFederatedUserCredentialStore
-
getStoredCredentialById
public CredentialModel getStoredCredentialById(RealmModel realm, String userId, String id)
- Specified by:
getStoredCredentialById
in interfaceUserFederatedUserCredentialStore
-
toModel
protected CredentialModel toModel(FederatedUserCredentialEntity entity)
-
getStoredCredentialsStream
public Stream<CredentialModel> getStoredCredentialsStream(RealmModel realm, String userId)
- Specified by:
getStoredCredentialsStream
in interfaceUserFederatedUserCredentialStore
- Specified by:
getStoredCredentialsStream
in interfaceUserFederatedUserCredentialStore.Streams
-
getStoredCredentialsByTypeStream
public Stream<CredentialModel> getStoredCredentialsByTypeStream(RealmModel realm, String userId, String type)
- Specified by:
getStoredCredentialsByTypeStream
in interfaceUserFederatedUserCredentialStore
- Specified by:
getStoredCredentialsByTypeStream
in interfaceUserFederatedUserCredentialStore.Streams
-
getStoredCredentialByNameAndType
public CredentialModel getStoredCredentialByNameAndType(RealmModel realm, String userId, String name, String type)
- Specified by:
getStoredCredentialByNameAndType
in interfaceUserFederatedUserCredentialStore
-
getStoredUsersStream
public Stream<String> getStoredUsersStream(RealmModel realm, Integer first, Integer max)
- Specified by:
getStoredUsersStream
in interfaceUserFederatedStorageProvider
- Specified by:
getStoredUsersStream
in interfaceUserFederatedStorageProvider.Streams
-
updateCredential
public void updateCredential(RealmModel realm, UserModel user, CredentialModel cred)
- Specified by:
updateCredential
in interfaceUserCredentialStore
-
createCredential
public CredentialModel createCredential(RealmModel realm, UserModel user, CredentialModel cred)
- Specified by:
createCredential
in interfaceUserCredentialStore
-
removeStoredCredential
public boolean removeStoredCredential(RealmModel realm, UserModel user, String id)
- Specified by:
removeStoredCredential
in interfaceUserCredentialStore
-
getStoredCredentialById
public CredentialModel getStoredCredentialById(RealmModel realm, UserModel user, String id)
- Specified by:
getStoredCredentialById
in interfaceUserCredentialStore
-
getStoredCredentialsStream
public Stream<CredentialModel> getStoredCredentialsStream(RealmModel realm, UserModel user)
- Specified by:
getStoredCredentialsStream
in interfaceUserCredentialStore
- Specified by:
getStoredCredentialsStream
in interfaceUserCredentialStore.Streams
-
getStoredCredentialsByTypeStream
public Stream<CredentialModel> getStoredCredentialsByTypeStream(RealmModel realm, UserModel user, String type)
- Specified by:
getStoredCredentialsByTypeStream
in interfaceUserCredentialStore
- Specified by:
getStoredCredentialsByTypeStream
in interfaceUserCredentialStore.Streams
-
getStoredCredentialByNameAndType
public CredentialModel getStoredCredentialByNameAndType(RealmModel realm, UserModel user, String name, String type)
- Specified by:
getStoredCredentialByNameAndType
in interfaceUserCredentialStore
-
moveCredentialTo
public boolean moveCredentialTo(RealmModel realm, UserModel user, String id, String newPreviousCredentialId)
- Specified by:
moveCredentialTo
in interfaceUserCredentialStore
-
getStoredUsersCount
public int getStoredUsersCount(RealmModel realm)
- Specified by:
getStoredUsersCount
in interfaceUserFederatedStorageProvider
-
preRemove
public void preRemove(RealmModel realm)
- Specified by:
preRemove
in interfaceUserFederatedStorageProvider
-
preRemove
public void preRemove(RealmModel realm, RoleModel role)
- Specified by:
preRemove
in interfaceUserFederatedStorageProvider
-
preRemove
public void preRemove(RealmModel realm, GroupModel group)
- Specified by:
preRemove
in interfaceUserFederatedStorageProvider
-
preRemove
public void preRemove(RealmModel realm, ClientModel client)
- Specified by:
preRemove
in interfaceUserFederatedStorageProvider
-
preRemove
public void preRemove(ProtocolMapperModel protocolMapper)
- Specified by:
preRemove
in interfaceUserFederatedStorageProvider
-
preRemove
public void preRemove(ClientScopeModel clientScope)
- Specified by:
preRemove
in interfaceUserFederatedStorageProvider
-
preRemove
public void preRemove(RealmModel realm, UserModel user)
- Specified by:
preRemove
in interfaceUserFederatedStorageProvider
-
preRemove
public void preRemove(RealmModel realm, ComponentModel model)
- Specified by:
preRemove
in interfaceUserFederatedStorageProvider
-
-