Package org.keycloak.models.jpa
Class JpaUserCredentialStore
- java.lang.Object
-
- org.keycloak.models.jpa.JpaUserCredentialStore
-
- All Implemented Interfaces:
UserCredentialStore
,Provider
public class JpaUserCredentialStore extends Object implements UserCredentialStore
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.keycloak.credential.UserCredentialStore
UserCredentialStore.Streams
-
-
Field Summary
Fields Modifier and Type Field Description protected javax.persistence.EntityManager
em
protected static org.jboss.logging.Logger
logger
static int
PRIORITY_DIFFERENCE
-
Constructor Summary
Constructors Constructor Description JpaUserCredentialStore(KeycloakSession session, javax.persistence.EntityManager em)
-
Method Summary
-
-
-
Field Detail
-
PRIORITY_DIFFERENCE
public static final int PRIORITY_DIFFERENCE
- See Also:
- Constant Field Values
-
logger
protected static final org.jboss.logging.Logger logger
-
em
protected final javax.persistence.EntityManager em
-
-
Constructor Detail
-
JpaUserCredentialStore
public JpaUserCredentialStore(KeycloakSession session, javax.persistence.EntityManager em)
-
-
Method Detail
-
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)
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
public CredentialModel getStoredCredentialById(RealmModel realm, UserModel user, String id)
- Specified by:
getStoredCredentialById
in interfaceUserCredentialStore
-
getStoredCredentialsStream
public Stream<CredentialModel> getStoredCredentialsStream(RealmModel realm, UserModel user)
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
-
moveCredentialTo
public boolean moveCredentialTo(RealmModel realm, UserModel user, String id, String newPreviousCredentialId)
- Specified by:
moveCredentialTo
in interfaceUserCredentialStore
-
-