Package org.keycloak.credential
Class UserCredentialManager
java.lang.Object
org.keycloak.storage.AbstractStorageManager<UserStorageProvider,UserStorageProviderModel>
org.keycloak.credential.UserCredentialManager
- All Implemented Interfaces:
SubjectCredentialManager
- Direct Known Subclasses:
SubjectCredentialManagerCacheAdapter
public class UserCredentialManager
extends AbstractStorageManager<UserStorageProvider,UserStorageProviderModel>
implements SubjectCredentialManager
Handling credentials for a given user for the store.
- Author:
- Alexander Schwartz
-
Constructor Summary
ConstructorDescriptionUserCredentialManager
(KeycloakSession session, RealmModel realm, UserModel user) -
Method Summary
Modifier and TypeMethodDescriptionUpdates a credential of the entity with an updatedCredentialModel
.void
disableCredentialType
(String credentialType) Disable a credential by type.List the credentials that can be disabled, for example, to show the list to the entity (aka user) or an admin.Read a stored credential.getStoredCredentialByNameAndType
(String name, String type) Read stored credentials by type as a stream.Read stored credentials as a stream.boolean
isConfiguredFor
(String type) Check if the credential type is configured for this entity.boolean
isConfiguredLocally
(String type) boolean
isValid
(List<CredentialInput> inputs) Validate a list of credentials.boolean
moveStoredCredentialTo
(String id, String newPreviousCredentialId) Re-order the stored credentials.boolean
Updates a credential of the entity with an updatedCredentialModel
.boolean
updateCredential
(CredentialInput input) Updates a credential of the entity with the inputs provided by the entity.void
updateCredentialLabel
(String credentialId, String userLabel) Update the label for a stored credentials chosen by the owner of the entity.void
Updates a credential of the entity with an updatedCredentialModel
.Methods inherited from class org.keycloak.storage.AbstractStorageManager
consumeEnabledStorageProvidersWithTimeout, flatMapEnabledStorageProvidersWithTimeout, getEnabledStorageProviders, getStorageProviderFactory, getStorageProviderInstance, getStorageProviderInstance, getStorageProviderInstance, getStorageProviderInstance, getStorageProviderModel, getStorageProviderModels, getStorageProviderTimeout, mapEnabledStorageProvidersWithTimeout
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.keycloak.models.SubjectCredentialManager
isValid
-
Constructor Details
-
UserCredentialManager
-
-
Method Details
-
isValid
Description copied from interface:SubjectCredentialManager
Validate a list of credentials.- Specified by:
isValid
in interfaceSubjectCredentialManager
- Returns:
true
if inputs are valid
-
updateCredential
Description copied from interface:SubjectCredentialManager
Updates a credential of the entity with the inputs provided by the entity.- Specified by:
updateCredential
in interfaceSubjectCredentialManager
- Returns:
true
if credentials have been updated successfully
-
updateStoredCredential
Description copied from interface:SubjectCredentialManager
Updates a credential of the entity with an updatedCredentialModel
. Usually called by aCredentialProvider
.- Specified by:
updateStoredCredential
in interfaceSubjectCredentialManager
-
createStoredCredential
Description copied from interface:SubjectCredentialManager
Updates a credential of the entity with an updatedCredentialModel
. Usually called by aCredentialProvider
.- Specified by:
createStoredCredential
in interfaceSubjectCredentialManager
-
removeStoredCredentialById
Description copied from interface:SubjectCredentialManager
Updates a credential of the entity with an updatedCredentialModel
. Usually called by aCredentialProvider
, or from the account management when a user removes, for example, an OTP token.- Specified by:
removeStoredCredentialById
in interfaceSubjectCredentialManager
-
getStoredCredentialById
Description copied from interface:SubjectCredentialManager
Read a stored credential.- Specified by:
getStoredCredentialById
in interfaceSubjectCredentialManager
-
getStoredCredentialsStream
Description copied from interface:SubjectCredentialManager
Read stored credentials as a stream.- Specified by:
getStoredCredentialsStream
in interfaceSubjectCredentialManager
-
getStoredCredentialsByTypeStream
Description copied from interface:SubjectCredentialManager
Read stored credentials by type as a stream.- Specified by:
getStoredCredentialsByTypeStream
in interfaceSubjectCredentialManager
-
getStoredCredentialByNameAndType
- Specified by:
getStoredCredentialByNameAndType
in interfaceSubjectCredentialManager
-
moveStoredCredentialTo
Description copied from interface:SubjectCredentialManager
Re-order the stored credentials.- Specified by:
moveStoredCredentialTo
in interfaceSubjectCredentialManager
-
updateCredentialLabel
Description copied from interface:SubjectCredentialManager
Update the label for a stored credentials chosen by the owner of the entity.- Specified by:
updateCredentialLabel
in interfaceSubjectCredentialManager
-
disableCredentialType
Description copied from interface:SubjectCredentialManager
Disable a credential by type.- Specified by:
disableCredentialType
in interfaceSubjectCredentialManager
-
getDisableableCredentialTypesStream
Description copied from interface:SubjectCredentialManager
List the credentials that can be disabled, for example, to show the list to the entity (aka user) or an admin.- Specified by:
getDisableableCredentialTypesStream
in interfaceSubjectCredentialManager
- Returns:
- stream with credential types that can be disabled
-
isConfiguredFor
Description copied from interface:SubjectCredentialManager
Check if the credential type is configured for this entity.- Specified by:
isConfiguredFor
in interfaceSubjectCredentialManager
- Parameters:
type
- credential type to check- Returns:
true
if the credential type has been
-
isConfiguredLocally
- Specified by:
isConfiguredLocally
in interfaceSubjectCredentialManager
-
getConfiguredUserStorageCredentialTypesStream
- Specified by:
getConfiguredUserStorageCredentialTypesStream
in interfaceSubjectCredentialManager
-
createCredentialThroughProvider
- Specified by:
createCredentialThroughProvider
in interfaceSubjectCredentialManager
-