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
FieldsModifier and TypeFieldDescriptionprotected final jakarta.persistence.EntityManagerprotected static final org.jboss.logging.Loggerstatic final int -
Constructor Summary
ConstructorsConstructorDescriptionJpaUserCredentialStore(KeycloakSession session, jakarta.persistence.EntityManager em) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()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.booleanmoveCredentialTo(RealmModel realm, UserModel user, String id, String newPreviousCredentialId) booleanremoveStoredCredential(RealmModel realm, UserModel user, String id) Removes credential with theidfor theuser.voidupdateCredential(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:
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
-
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
-
close
public void close() -
moveCredentialTo
public boolean moveCredentialTo(RealmModel realm, UserModel user, String id, String newPreviousCredentialId) - Specified by:
moveCredentialToin interfaceUserCredentialStore
-