Package org.keycloak.credential
Interface UserCredentialStore
- All Superinterfaces:
Provider
- All Known Implementing Classes:
JpaUserCredentialStore,JpaUserFederatedStorageProvider,JpaUserProvider
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
Method Summary
Modifier and TypeMethodDescriptioncreateCredential(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) booleanupdateCredential(RealmModel realm, UserModel user, CredentialModel oldCred, CredentialModel newCred) Replaces a stored credential with a new version, but only if it still has the content of the old version.
-
Method Details
-
updateCredential
-
updateCredential
boolean updateCredential(RealmModel realm, UserModel user, CredentialModel oldCred, CredentialModel newCred) Replaces a stored credential with a new version, but only if it still has the content of the old version.Implementations must make the check and the replacement atomic, for example by locking the stored credential.
- Parameters:
realm- the realmuser- the useroldCred- the credential as it was read, identified by its idnewCred- the credential to store instead- Returns:
trueif the credential was replaced,falseif it was changed or removed in the meantime
-
createCredential
-
removeStoredCredential
Removes credential with theidfor theuser.- 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
-
getStoredCredentialsStream
Obtains the stored credentials associated with the specified user.- Parameters:
realm- a reference to the realm.user- the user whose credentials are being searched.- Returns:
- a non-null
Streamof credentials.
-
getStoredCredentialsByTypeStream
Stream<CredentialModel> getStoredCredentialsByTypeStream(RealmModel realm, UserModel user, String type) Obtains the stored credentials associated with the specified user that match the specified type.- 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
CredentialModel getStoredCredentialByNameAndType(RealmModel realm, UserModel user, String name, String type) -
moveCredentialTo
boolean moveCredentialTo(RealmModel realm, UserModel user, String id, String newPreviousCredentialId)
-