Package org.keycloak.models.jpa
Class JpaUserProvider
java.lang.Object
org.keycloak.models.jpa.JpaUserProvider
- All Implemented Interfaces:
PartialEvaluationStorageProvider,UserCredentialStore,JpaUserPartialEvaluationProvider,UserProvider,Provider,UserBulkUpdateProvider,UserCountMethodsProvider,UserLookupProvider,UserQueryMethodsProvider,UserQueryProvider,UserRegistrationProvider
public class JpaUserProvider
extends Object
implements UserProvider, UserCredentialStore, JpaUserPartialEvaluationProvider
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJpaUserProvider(KeycloakSession session, jakarta.persistence.EntityManager em) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConsent(RealmModel realm, String userId, UserConsentModel consent) Add user consent for the user.voidaddFederatedIdentity(RealmModel realm, UserModel user, FederatedIdentityModel identity) Adds a federated identity link for the user within the realmaddUser(RealmModel realm, String username) All storage providers that implement this interface will be looped through.addUser(RealmModel realm, String id, String username, boolean addDefaultRoles, boolean addDefaultRequiredActions) Adds a new user into the storage.voidclose()createCredential(RealmModel realm, UserModel user, CredentialModel cred) protected voidensureEmailConstraint(List<UserEntity> users, RealmModel realm) getConsentByClient(RealmModel realm, String userId, String clientId) Returns UserConsentModel given by a user with the userId for the client with clientInternalIdgetConsentsStream(RealmModel realm, String userId) Obtains the consents associated with the user identified by the specifieduserId.jakarta.persistence.EntityManagergetFederatedIdentitiesStream(RealmModel realm, UserModel user) Obtains the federated identities of the specified user.getFederatedIdentity(RealmModel realm, UserModel user, String identityProvider) Returns details of the association between the user and the socialProvider.getGroupMembersStream(RealmModel realm, GroupModel group) Obtains users that belong to a specific group.getGroupMembersStream(RealmModel realm, GroupModel group, Integer firstResult, Integer maxResults) Obtains users that belong to a specific group.getGroupMembersStream(RealmModel realm, GroupModel group, String search, Boolean exact, Integer first, Integer max) Obtains users that belong to a specific group, filtered according to the search parameters.intgetNotBeforeOfUser(RealmModel realm, UserModel user) Gets the notBefore value for the given usergetRoleMembersStream(RealmModel realm, RoleModel role) Obtains users that have the specified role.getRoleMembersStream(RealmModel realm, RoleModel role, Integer firstResult, Integer maxResults) Searches for users that have the specified role.getServiceAccount(ClientModel client) Return a UserModel representing service account of the clientgetStoredCredentialById(RealmModel realm, UserModel user, String id) getStoredCredentialByNameAndType(RealmModel realm, UserModel user, String name, String type) getStoredCredentialsByTypeStream(RealmModel realm, UserModel user, String type) Obtains the stored credentials associated with the specified user that match the specified type.getStoredCredentialsStream(RealmModel realm, UserModel user) Obtains the stored credentials associated with the specified user.getUserByEmail(RealmModel realm, String email) Returns a user with the given email belonging to the realmgetUserByFederatedIdentity(RealmModel realm, FederatedIdentityModel identity) Returns a userModel that corresponds to the given socialLink.getUserById(RealmModel realm, String id) Returns a user with the given id belonging to the realmgetUserByUsername(RealmModel realm, String username) Exact search for a user by its username.intgetUsersCount(RealmModel realm, boolean includeServiceAccount) Returns the number of users.intgetUsersCount(RealmModel realm, String search) Returns the number of users that would be returned by a call tosearchForUserStreamintgetUsersCount(RealmModel realm, String search, Set<String> groupIds) Returns the number of users that would be returned by a call tosearchForUserStreamand are members of at least one of the groups given by thegroupIdsset.intgetUsersCount(RealmModel realm, Map<String, String> params) Returns the number of users that match the given filter parameters.intgetUsersCount(RealmModel realm, Map<String, String> params, Set<String> groupIds) Returns the number of users that match the given filter parameters and is in at least one of the given groups.intgetUsersCount(RealmModel realm, Set<String> groupIds) Returns the number of users that are in at least one of the groups given.voidgrantToAllUsers(RealmModel realm, RoleModel role) Grants the given role to all users from particular realm.booleanmoveCredentialTo(RealmModel realm, UserModel user, String id, String newPreviousCredentialId) voidpreRemove(ClientScopeModel clientScope) Called when a client scope is removed.voidpreRemove(ProtocolMapperModel protocolMapper) Called when a protocolMapper is removedvoidpreRemove(RealmModel realm) Called when a realm is removed.voidpreRemove(RealmModel realm, ComponentModel component) Called when a component is removed.voidpreRemove(RealmModel realm, ClientModel client) Called when a client is removed.voidpreRemove(RealmModel realm, GroupModel group) Called when a group is removed.voidpreRemove(RealmModel realm, IdentityProviderModel provider) Called when an identity provider is removed.voidpreRemove(RealmModel realm, RoleModel role) Called when a role is removed.protected voidremoveConsentByClientStorageProvider(RealmModel realm, String providerId) booleanremoveFederatedIdentity(RealmModel realm, UserModel user, String identityProvider) Removes federation link between the user and the identity provider given by its idvoidremoveImportedUsers(RealmModel realm, String storageProviderId) Removes any imported users from a specific User Storage Provider.booleanremoveStoredCredential(RealmModel realm, UserModel user, String id) Removes credential with theidfor theuser.booleanremoveUser(RealmModel realm, UserModel user) Called if user originated from this provider.booleanrevokeConsentForClient(RealmModel realm, String userId, String clientId) Remove a user consent given by the user id and client idsearchForUserByUserAttributeStream(RealmModel realm, String attrName, String attrValue) Searches for users that have a specific attribute with a specific value.searchForUserStream(RealmModel realm, String search, Integer firstResult, Integer maxResults) Searches for users whose username, email, first name or last name contain any of the strings insearchseparated by whitespace.searchForUserStream(RealmModel realm, Map<String, String> attributes, Integer firstResult, Integer maxResults) Searches for user by parameter.voidsetNotBeforeForUser(RealmModel realm, UserModel user, int notBefore) Sets the notBefore value for the given userprotected CredentialModeltoModel(CredentialEntity entity) voidunlinkUsers(RealmModel realm, String storageProviderId) Set federation link tonullto imported users of a specific User Storage ProvidervoidupdateConsent(RealmModel realm, String userId, UserConsentModel consent) Update client scopes in the stored user consentvoidupdateCredential(RealmModel realm, UserModel user, CredentialModel cred) voidupdateFederatedIdentity(RealmModel realm, UserModel federatedUser, FederatedIdentityModel federatedIdentityModel) Update details of association between the federatedUser and the idp given by the federatedIdentityModelMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.keycloak.models.jpa.JpaUserPartialEvaluationProvider
getFilters, getNegateFiltersMethods inherited from interface org.keycloak.storage.user.UserCountMethodsProvider
getUsersCountMethods inherited from interface org.keycloak.storage.user.UserLookupProvider
getUserByCredentialMethods inherited from interface org.keycloak.storage.user.UserQueryMethodsProvider
searchForUserStream, searchForUserStream
-
Field Details
-
em
protected jakarta.persistence.EntityManager em
-
-
Constructor Details
-
JpaUserProvider
-
-
Method Details
-
addUser
public UserModel addUser(RealmModel realm, String id, String username, boolean addDefaultRoles, boolean addDefaultRequiredActions) Description copied from interface:UserProviderAdds a new user into the storage. only used for local storage- Specified by:
addUserin interfaceUserProvider- Parameters:
realm- the realm that user will be created inid- id of the new user. Should be generated to a random value ifnull.username- usernameaddDefaultRoles- iftrue, the user should join all realm default rolesaddDefaultRequiredActions- iftrue, all default required actions are added to the created user- Returns:
- model of created user
-
addUser
Description copied from interface:UserRegistrationProviderAll storage providers that implement this interface will be looped through. If this method returns null, then the next storage provider's addUser() method will be called. If no storage providers handle the add, then the user will be created in local storage. Returning null is useful when you want optional support for adding users. For example, our LDAP provider can enable and disable the ability to add users.- Specified by:
addUserin interfaceUserRegistrationProvider- Parameters:
realm- a reference to the realmusername- a username the created user will be assigned- Returns:
- a model of created user
-
removeUser
Description copied from interface:UserRegistrationProviderCalled if user originated from this provider. If a local user is linked to this provider, this method will be called before local storage's removeUser() method is invoked. If you are using an import strategy, and this is a local user linked to this provider, this method will be called before local storage's removeUser() method is invoked. Also, you DO NOT need to remove the imported user. The runtime will handle this for you.- Specified by:
removeUserin interfaceUserRegistrationProvider- Parameters:
realm- a reference to the realmuser- a reference to the user that is removed- Returns:
- true if the user was removed, false otherwise
-
addFederatedIdentity
Description copied from interface:UserProviderAdds a federated identity link for the user within the realm- Specified by:
addFederatedIdentityin interfaceUserProvider- Parameters:
realm- a reference to the realmuser- the user modelidentity- the federated identity model containing all details of the association between the user and the identity provider
-
updateFederatedIdentity
public void updateFederatedIdentity(RealmModel realm, UserModel federatedUser, FederatedIdentityModel federatedIdentityModel) Description copied from interface:UserProviderUpdate details of association between the federatedUser and the idp given by the federatedIdentityModel- Specified by:
updateFederatedIdentityin interfaceUserProvider- Parameters:
realm- a reference to the realmfederatedUser- the user modelfederatedIdentityModel- the federated identity model containing all details of the association between the user and the identity provider
-
removeFederatedIdentity
Description copied from interface:UserProviderRemoves federation link between the user and the identity provider given by its id- Specified by:
removeFederatedIdentityin interfaceUserProvider- Parameters:
realm- a reference to the realmuser- the user modelidentityProvider- alias of the identity provider, seeIdentityProviderModel.getAlias()- Returns:
trueif the association was removed,falseotherwise TODO: Make this method return Boolean so that store can return "I don't know" answer, this can be used for example in async stores
-
preRemove
Description copied from interface:UserProviderCalled when an identity provider is removed. Should remove all federated identities assigned to users from the provider.- Specified by:
preRemovein interfaceUserProvider- Parameters:
realm- a reference to the realmprovider- provider model
-
addConsent
Description copied from interface:UserProviderAdd user consent for the user.- Specified by:
addConsentin interfaceUserProvider- Parameters:
realm- a reference to the realmuserId- id of the userconsent- all details corresponding to the granted consent
-
getConsentByClient
Description copied from interface:UserProviderReturns UserConsentModel given by a user with the userId for the client with clientInternalId- Specified by:
getConsentByClientin interfaceUserProvider- Parameters:
realm- a reference to the realmuserId- id of the userclientId- id of the client- Returns:
- consent given by the user to the client or
nullif no consent or user exists
-
getConsentsStream
Description copied from interface:UserProviderObtains the consents associated with the user identified by the specifieduserId.- Specified by:
getConsentsStreamin interfaceUserProvider- Parameters:
realm- a reference to the realm.userId- the user identifier.- Returns:
- a non-null
Streamof consents associated with the user.
-
updateConsent
Description copied from interface:UserProviderUpdate client scopes in the stored user consent- Specified by:
updateConsentin interfaceUserProvider- Parameters:
realm- a reference to the realmuserId- id of the userconsent- new details of the user consent
-
revokeConsentForClient
Description copied from interface:UserProviderRemove a user consent given by the user id and client id- Specified by:
revokeConsentForClientin interfaceUserProvider- Parameters:
realm- a reference to the realmuserId- id of the userclientId- id of the client- Returns:
trueif the consent was removed,falseotherwise TODO: Make this method return Boolean so that store can return "I don't know" answer, this can be used for example in async stores
-
setNotBeforeForUser
Description copied from interface:UserProviderSets the notBefore value for the given user- Specified by:
setNotBeforeForUserin interfaceUserProvider- Parameters:
realm- a reference to the realmuser- the user modelnotBefore- new value for notBefore
-
getNotBeforeOfUser
Description copied from interface:UserProviderGets the notBefore value for the given user- Specified by:
getNotBeforeOfUserin interfaceUserProvider- Parameters:
realm- a reference to the realmuser- the user model- Returns:
- the value of notBefore
-
grantToAllUsers
Description copied from interface:UserBulkUpdateProviderGrants the given role to all users from particular realm. The role has to belong to the realm.- Specified by:
grantToAllUsersin interfaceUserBulkUpdateProvider- Parameters:
realm- Realmrole- Role to be granted
-
preRemove
Description copied from interface:UserProviderCalled when a realm is removed. Should remove all users that belong to the realm.- Specified by:
preRemovein interfaceUserProvider- Parameters:
realm- a reference to the realm
-
removeImportedUsers
Description copied from interface:UserProviderRemoves any imported users from a specific User Storage Provider.- Specified by:
removeImportedUsersin interfaceUserProvider- Parameters:
realm- a reference to the realmstorageProviderId- id of the user storage provider
-
unlinkUsers
Description copied from interface:UserProviderSet federation link tonullto imported users of a specific User Storage Provider- Specified by:
unlinkUsersin interfaceUserProvider- Parameters:
realm- a reference to the realmstorageProviderId- id of the storage provider
-
preRemove
Description copied from interface:UserProviderCalled when a role is removed. Should remove the role membership for each user.- Specified by:
preRemovein interfaceUserProvider- Parameters:
realm- a reference to the realmrole- the role model
-
preRemove
Description copied from interface:UserProviderCalled when a client is removed. Should remove all user consents associated with the client- Specified by:
preRemovein interfaceUserProvider- Parameters:
realm- a reference to the realmclient- the client model
-
preRemove
Description copied from interface:UserProviderCalled when a protocolMapper is removed- Specified by:
preRemovein interfaceUserProvider- Parameters:
protocolMapper- the protocolMapper model
-
preRemove
Description copied from interface:UserProviderCalled when a client scope is removed. Should remove the clientScope from each user consent- Specified by:
preRemovein interfaceUserProvider- Parameters:
clientScope- the clientScope model
-
getGroupMembersStream
Description copied from interface:UserQueryMethodsProviderObtains users that belong to a specific group.- Specified by:
getGroupMembersStreamin interfaceUserQueryMethodsProvider- Parameters:
realm- a reference to the realm.group- a reference to the group.- Returns:
- a non-null
Streamof users that belong to the group.
-
getRoleMembersStream
Description copied from interface:UserQueryMethodsProviderObtains users that have the specified role.- Specified by:
getRoleMembersStreamin interfaceUserQueryMethodsProvider- Parameters:
realm- a reference to the realm.role- a reference to the role.- Returns:
- a non-null
Streamof users that have the specified role.
-
preRemove
Description copied from interface:UserProviderCalled when a group is removed. Should remove the group membership for each user.- Specified by:
preRemovein interfaceUserProvider- Parameters:
realm- a reference to the realmgroup- the group model
-
getUserById
Description copied from interface:UserLookupProviderReturns a user with the given id belonging to the realm- Specified by:
getUserByIdin interfaceUserLookupProvider- Parameters:
realm- the realm modelid- id of the user- Returns:
- found user model, or
nullif no such user exists
-
getUserByUsername
Description copied from interface:UserLookupProviderExact search for a user by its username. Returns a user with the given username belonging to the realm- Specified by:
getUserByUsernamein interfaceUserLookupProvider- Parameters:
realm- the realm modelusername- (case-sensitivity is controlled by storage)- Returns:
- found user model, or
nullif no such user exists
-
getUserByEmail
Description copied from interface:UserLookupProviderReturns a user with the given email belonging to the realm- Specified by:
getUserByEmailin interfaceUserLookupProvider- Parameters:
realm- the realm modelemail- email address- Returns:
- found user model, or
nullif no such user exists
-
close
public void close() -
getUserByFederatedIdentity
Description copied from interface:UserProviderReturns a userModel that corresponds to the given socialLink.- Specified by:
getUserByFederatedIdentityin interfaceUserProvider- Parameters:
realm- a reference to the realmidentity- the socialLink- Returns:
- the user corresponding to socialLink and
nullif no such user exists
-
getServiceAccount
Description copied from interface:UserProviderReturn a UserModel representing service account of the client- Specified by:
getServiceAccountin interfaceUserProvider- Parameters:
client- the client model- Returns:
- userModel representing service account of the client
-
getUsersCount
Description copied from interface:UserCountMethodsProviderReturns the number of users.- Specified by:
getUsersCountin interfaceUserCountMethodsProvider- Parameters:
realm- the realmincludeServiceAccount- if true, the number of users will also include service accounts. Otherwise, only the number of users.- Returns:
- the number of users
-
getUsersCount
Description copied from interface:UserCountMethodsProviderReturns the number of users that are in at least one of the groups given.- Specified by:
getUsersCountin interfaceUserCountMethodsProvider- Parameters:
realm- the realmgroupIds- set of groups IDs, the returned user needs to belong to at least one of them- Returns:
- the number of users that are in at least one of the groups
-
getUsersCount
Description copied from interface:UserCountMethodsProviderReturns the number of users that would be returned by a call tosearchForUserStream- Specified by:
getUsersCountin interfaceUserCountMethodsProvider- Parameters:
realm- the realmsearch- case insensitive list of strings separated by whitespaces.- Returns:
- number of users that match the search
-
getUsersCount
Description copied from interface:UserCountMethodsProviderReturns the number of users that would be returned by a call tosearchForUserStreamand are members of at least one of the groups given by thegroupIdsset.- Specified by:
getUsersCountin interfaceUserCountMethodsProvider- Parameters:
realm- the realmsearch- case insensitive list of strings separated by whitespaces.groupIds- set of groups IDs, the returned user needs to belong to at least one of them- Returns:
- number of users that match the search and given groups
-
getUsersCount
Description copied from interface:UserCountMethodsProviderReturns the number of users that match the given filter parameters.- Specified by:
getUsersCountin interfaceUserCountMethodsProvider- Parameters:
realm- the realmparams- filter parameters- Returns:
- number of users that match the given filters
-
getUsersCount
Description copied from interface:UserCountMethodsProviderReturns the number of users that match the given filter parameters and is in at least one of the given groups.- Specified by:
getUsersCountin interfaceUserCountMethodsProvider- Parameters:
realm- the realmparams- filter parametersgroupIds- set if groups to check for- Returns:
- number of users that match the given filters and groups
-
getGroupMembersStream
public Stream<UserModel> getGroupMembersStream(RealmModel realm, GroupModel group, Integer firstResult, Integer maxResults) Description copied from interface:UserQueryMethodsProviderObtains users that belong to a specific group.- Specified by:
getGroupMembersStreamin interfaceUserQueryMethodsProvider- Parameters:
realm- a reference to the realm.group- a reference to the group.firstResult- first result to return. Ignored if negative, zero, ornull.maxResults- maximum number of results to return. Ignored if negative ornull.- Returns:
- a non-null
Streamof users that belong to the group.
-
getGroupMembersStream
public Stream<UserModel> getGroupMembersStream(RealmModel realm, GroupModel group, String search, Boolean exact, Integer first, Integer max) Description copied from interface:UserQueryMethodsProviderObtains users that belong to a specific group, filtered according to the search parameters.- Specified by:
getGroupMembersStreamin interfaceUserQueryMethodsProvider- Parameters:
realm- a reference to the realm.group- a reference to the group.search- the search string. It can represent either the user's username, e-mail, first name, or last name.exact- a boolean indicating if the search should be exact or not. Iftrue, it selects only users whose main attributes (username, e-mail, first name, or last name) exactly match the search string. Iffalse, it selects the users whose main attributes partially match the search string.first- the position of the first result to be processed (pagination offset). Ignored if negative ornull.max- the maximum number of results to be returned. Ignored if negative ornull.- Returns:
- a non-null
Streamof filtered users that belong to the group.
-
getRoleMembersStream
public Stream<UserModel> getRoleMembersStream(RealmModel realm, RoleModel role, Integer firstResult, Integer maxResults) Description copied from interface:UserQueryMethodsProviderSearches for users that have the specified role.- Specified by:
getRoleMembersStreamin interfaceUserQueryMethodsProvider- Parameters:
realm- a reference to the realm.role- a reference to the role.firstResult- first result to return. Ignored if negative ornull.maxResults- maximum number of results to return. Ignored if negative ornull.- Returns:
- a non-null
Streamof users that have the specified role.
-
searchForUserStream
public Stream<UserModel> searchForUserStream(RealmModel realm, String search, Integer firstResult, Integer maxResults) Description copied from interface:UserQueryMethodsProviderSearches for users whose username, email, first name or last name contain any of the strings insearchseparated by whitespace. If possible, implementations should treat the parameter values as partial match patterns (i.e. in RDMBS terms use LIKE). This method is used by the admin console search box- Specified by:
searchForUserStreamin interfaceUserQueryMethodsProvider- Parameters:
realm- a reference to the realm.search- case insensitive list of string separated by whitespaces.firstResult- first result to return. Ignored if negative, zero, ornull.maxResults- maximum number of results to return. Ignored if negative ornull.- Returns:
- a non-null
Streamof users that match the search criteria.
-
searchForUserStream
public Stream<UserModel> searchForUserStream(RealmModel realm, Map<String, String> attributes, Integer firstResult, Integer maxResults) Description copied from interface:UserQueryMethodsProviderSearches for user by parameter. If possible, implementations should treat the parameter values as partial match patterns (i.e. in RDMBS terms use LIKE). Valid parameters are:UserModel.SEARCH- search for users whose username, email, first name or last name contain any of the strings insearchseparated by whitespace, whenSEARCHis set all other params are ignoredUserModel.FIRST_NAME- first name (case insensitive string)UserModel.LAST_NAME- last name (case insensitive string)UserModel.EMAIL- email (case insensitive string)UserModel.USERNAME- username (case insensitive string)UserModel.EXACT- whether search with FIRST_NAME, LAST_NAME, USERNAME or EMAIL should be exact matchUserModel.EMAIL_VERIFIED- search only for users with verified/non-verified email (true/false)UserModel.ENABLED- search only for enabled/disabled users (true/false)UserModel.IDP_ALIAS- search only for users that have a federated identity from idp with the given alias configured (case sensitive string)UserModel.IDP_USER_ID- search for users with federated identity with the given userId (case sensitive string)
Any other parameters will be treated as custom user attributes.
This method is used by the REST API when querying users.
- Specified by:
searchForUserStreamin interfaceUserQueryMethodsProvider- Parameters:
realm- a reference to the realm.attributes- a map containing the search parameters.firstResult- first result to return. Ignored if negative, zero, ornull.maxResults- maximum number of results to return. Ignored if negative ornull.- Returns:
- a non-null
Streamof users that match the search criteria.
-
searchForUserByUserAttributeStream
public Stream<UserModel> searchForUserByUserAttributeStream(RealmModel realm, String attrName, String attrValue) Description copied from interface:UserQueryMethodsProviderSearches for users that have a specific attribute with a specific value.- Specified by:
searchForUserByUserAttributeStreamin interfaceUserQueryMethodsProvider- Parameters:
realm- a reference to the realm.attrName- the attribute name.attrValue- the attribute value.- Returns:
- a non-null
Streamof users that match the search criteria.
-
getFederatedIdentitiesStream
public Stream<FederatedIdentityModel> getFederatedIdentitiesStream(RealmModel realm, UserModel user) Description copied from interface:UserProviderObtains the federated identities of the specified user.- Specified by:
getFederatedIdentitiesStreamin interfaceUserProvider- Parameters:
realm- a reference to the realm.user- the reference to the user.- Returns:
- a non-null
Streamof federated identities associated with the user.
-
getFederatedIdentity
public FederatedIdentityModel getFederatedIdentity(RealmModel realm, UserModel user, String identityProvider) Description copied from interface:UserProviderReturns details of the association between the user and the socialProvider.- Specified by:
getFederatedIdentityin interfaceUserProvider- Parameters:
realm- a reference to the realmuser- the user modelidentityProvider- the id of the identity provider- Returns:
- federatedIdentityModel or
nullif no association exists
-
preRemove
Description copied from interface:UserProviderCalled when a component is removed. Should remove all data in UserStorage associated with removed component. For example,- if component corresponds to UserStorageProvider all imported users from the provider should be removed,
- if component corresponds to ClientStorageProvider all consents granted for clients imported from the provider should be removed
- Specified by:
preRemovein interfaceUserProvider- Parameters:
realm- a reference to the realmcomponent- the component model
-
removeConsentByClientStorageProvider
-
updateCredential
- Specified by:
updateCredentialin interfaceUserCredentialStore
-
createCredential
- Specified by:
createCredentialin interfaceUserCredentialStore
-
removeStoredCredential
Description copied from interface:UserCredentialStoreRemoves credential with theidfor theuser.- Specified by:
removeStoredCredentialin interfaceUserCredentialStore- Parameters:
realm- realm.user- userid- id- Returns:
trueif the credential was removed,falseotherwise TODO: Make this method return Boolean so that store can return "I don't know" answer, this can be used for example in async stores
-
getStoredCredentialById
- Specified by:
getStoredCredentialByIdin interfaceUserCredentialStore
-
toModel
-
getStoredCredentialsStream
Description copied from interface:UserCredentialStoreObtains the stored credentials associated with the specified user.- Specified by:
getStoredCredentialsStreamin interfaceUserCredentialStore- Parameters:
realm- a reference to the realm.user- the user whose credentials are being searched.- Returns:
- a non-null
Streamof credentials.
-
getStoredCredentialsByTypeStream
public Stream<CredentialModel> getStoredCredentialsByTypeStream(RealmModel realm, UserModel user, String type) Description copied from interface:UserCredentialStoreObtains the stored credentials associated with the specified user that match the specified type.- Specified by:
getStoredCredentialsByTypeStreamin interfaceUserCredentialStore- Parameters:
realm- a reference to the realm.user- the user whose credentials are being searched.type- the type of credentials being searched.- Returns:
- a non-null
Streamof credentials.
-
getStoredCredentialByNameAndType
public CredentialModel getStoredCredentialByNameAndType(RealmModel realm, UserModel user, String name, String type) - Specified by:
getStoredCredentialByNameAndTypein interfaceUserCredentialStore
-
moveCredentialTo
public boolean moveCredentialTo(RealmModel realm, UserModel user, String id, String newPreviousCredentialId) - Specified by:
moveCredentialToin interfaceUserCredentialStore
-
ensureEmailConstraint
-
getSession
- Specified by:
getSessionin interfaceJpaUserPartialEvaluationProvider
-
getEntityManager
public jakarta.persistence.EntityManager getEntityManager()- Specified by:
getEntityManagerin interfaceJpaUserPartialEvaluationProvider
-