Package org.keycloak.models.jpa
Class JpaUserCredentialStore
java.lang.Object
org.keycloak.models.jpa.JpaUserCredentialStore
- All Implemented Interfaces:
UserCredentialStore
,Provider
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Field Summary
Modifier and TypeFieldDescriptionprotected final jakarta.persistence.EntityManager
protected static final org.jboss.logging.Logger
static final int
-
Constructor Summary
ConstructorDescriptionJpaUserCredentialStore
(KeycloakSession session, jakarta.persistence.EntityManager em) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
createCredential
(RealmModel realm, UserModel user, CredentialModel cred) getStoredCredentialById
(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.boolean
moveCredentialTo
(RealmModel realm, UserModel user, String id, String newPreviousCredentialId) boolean
removeStoredCredential
(RealmModel realm, UserModel user, String id) Removes credential with theid
for theuser
.void
updateCredential
(RealmModel realm, UserModel user, CredentialModel cred)
-
Field Details
-
PRIORITY_DIFFERENCE
public static final int PRIORITY_DIFFERENCE- See Also:
-
logger
protected static final org.jboss.logging.Logger logger -
em
protected final jakarta.persistence.EntityManager em
-
-
Constructor Details
-
JpaUserCredentialStore
-
-
Method Details
-
updateCredential
- Specified by:
updateCredential
in interfaceUserCredentialStore
-
createCredential
- Specified by:
createCredential
in interfaceUserCredentialStore
-
removeStoredCredential
Description copied from interface:UserCredentialStore
Removes credential with theid
for theuser
.- Specified by:
removeStoredCredential
in interfaceUserCredentialStore
- Parameters:
realm
- realm.user
- userid
- id- Returns:
true
if the credential was removed,false
otherwise 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:
getStoredCredentialById
in interfaceUserCredentialStore
-
getStoredCredentialsStream
Description copied from interface:UserCredentialStore
Obtains the stored credentials associated with the specified user.- Specified by:
getStoredCredentialsStream
in interfaceUserCredentialStore
- Parameters:
realm
- a reference to the realm.user
- the user whose credentials are being searched.- Returns:
- a non-null
Stream
of credentials.
-
getStoredCredentialsByTypeStream
public Stream<CredentialModel> getStoredCredentialsByTypeStream(RealmModel realm, UserModel user, String type) Description copied from interface:UserCredentialStore
Obtains the stored credentials associated with the specified user that match the specified type.- Specified by:
getStoredCredentialsByTypeStream
in 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
Stream
of credentials.
-
getStoredCredentialByNameAndType
public CredentialModel getStoredCredentialByNameAndType(RealmModel realm, UserModel user, String name, String type) - Specified by:
getStoredCredentialByNameAndType
in interfaceUserCredentialStore
-
close
public void close() -
moveCredentialTo
public boolean moveCredentialTo(RealmModel realm, UserModel user, String id, String newPreviousCredentialId) - Specified by:
moveCredentialTo
in interfaceUserCredentialStore
-