Class MapUserCredentialManager
- java.lang.Object
-
- org.keycloak.models.map.credential.MapUserCredentialManager
-
- All Implemented Interfaces:
SubjectCredentialManager
public class MapUserCredentialManager extends Object implements SubjectCredentialManager
Handling credentials for a given user. This serves as a wrapper to specific strategies. The wrapping code implements the logic forCredentialInputUpdater
s andCredentialInputValidator
s.- Author:
- Alexander Schwartz
-
-
Constructor Summary
Constructors Constructor Description MapUserCredentialManager(KeycloakSession session, RealmModel realm, UserModel user, MapUserEntity entity)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description CredentialModel
createCredentialThroughProvider(CredentialModel model)
Deprecated.CredentialModel
createStoredCredential(CredentialModel cred)
Updates a credential of the entity with an updatedCredentialModel
.void
disableCredentialType(String credentialType)
Disable a credential by type.Stream<String>
getConfiguredUserStorageCredentialTypesStream()
Deprecated.Stream<String>
getDisableableCredentialTypesStream()
List the credentials that can be disabled, for example, to show the list to the entity (aka user) or an admin.CredentialModel
getStoredCredentialById(String id)
Read a stored credential.CredentialModel
getStoredCredentialByNameAndType(String name, String type)
Stream<CredentialModel>
getStoredCredentialsByTypeStream(String type)
Read stored credentials by type as a stream.Stream<CredentialModel>
getStoredCredentialsStream()
Read stored credentials as a stream.boolean
isConfiguredFor(String type)
Check if the credential type is configured for this entity.boolean
isConfiguredLocally(String type)
Deprecated.boolean
isValid(List<CredentialInput> inputs)
Validate a list of credentials.boolean
moveStoredCredentialTo(String id, String newPreviousCredentialId)
Re-order the stored credentials.boolean
removeStoredCredentialById(String id)
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
updateStoredCredential(CredentialModel cred)
Updates a credential of the entity with an updatedCredentialModel
.-
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 Detail
-
MapUserCredentialManager
public MapUserCredentialManager(KeycloakSession session, RealmModel realm, UserModel user, MapUserEntity entity)
-
-
Method Detail
-
isValid
public boolean isValid(List<CredentialInput> inputs)
Description copied from interface:SubjectCredentialManager
Validate a list of credentials.- Specified by:
isValid
in interfaceSubjectCredentialManager
- Returns:
true
if inputs are valid
-
updateCredential
public boolean updateCredential(CredentialInput input)
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
public void updateStoredCredential(CredentialModel cred)
Description copied from interface:SubjectCredentialManager
Updates a credential of the entity with an updatedCredentialModel
. Usually called by aCredentialProvider
.- Specified by:
updateStoredCredential
in interfaceSubjectCredentialManager
-
createStoredCredential
public CredentialModel createStoredCredential(CredentialModel cred)
Description copied from interface:SubjectCredentialManager
Updates a credential of the entity with an updatedCredentialModel
. Usually called by aCredentialProvider
.- Specified by:
createStoredCredential
in interfaceSubjectCredentialManager
-
removeStoredCredentialById
public boolean removeStoredCredentialById(String id)
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
public CredentialModel getStoredCredentialById(String id)
Description copied from interface:SubjectCredentialManager
Read a stored credential.- Specified by:
getStoredCredentialById
in interfaceSubjectCredentialManager
-
getStoredCredentialsStream
public Stream<CredentialModel> getStoredCredentialsStream()
Description copied from interface:SubjectCredentialManager
Read stored credentials as a stream.- Specified by:
getStoredCredentialsStream
in interfaceSubjectCredentialManager
-
getStoredCredentialsByTypeStream
public Stream<CredentialModel> getStoredCredentialsByTypeStream(String type)
Description copied from interface:SubjectCredentialManager
Read stored credentials by type as a stream.- Specified by:
getStoredCredentialsByTypeStream
in interfaceSubjectCredentialManager
-
getStoredCredentialByNameAndType
public CredentialModel getStoredCredentialByNameAndType(String name, String type)
- Specified by:
getStoredCredentialByNameAndType
in interfaceSubjectCredentialManager
-
moveStoredCredentialTo
public boolean moveStoredCredentialTo(String id, String newPreviousCredentialId)
Description copied from interface:SubjectCredentialManager
Re-order the stored credentials.- Specified by:
moveStoredCredentialTo
in interfaceSubjectCredentialManager
-
updateCredentialLabel
public void updateCredentialLabel(String credentialId, String userLabel)
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
public void disableCredentialType(String credentialType)
Description copied from interface:SubjectCredentialManager
Disable a credential by type.- Specified by:
disableCredentialType
in interfaceSubjectCredentialManager
-
getDisableableCredentialTypesStream
public Stream<String> 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
public boolean isConfiguredFor(String type)
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
@Deprecated public boolean isConfiguredLocally(String type)
Deprecated.- Specified by:
isConfiguredLocally
in interfaceSubjectCredentialManager
-
getConfiguredUserStorageCredentialTypesStream
@Deprecated public Stream<String> getConfiguredUserStorageCredentialTypesStream()
Deprecated.- Specified by:
getConfiguredUserStorageCredentialTypesStream
in interfaceSubjectCredentialManager
-
createCredentialThroughProvider
@Deprecated public CredentialModel createCredentialThroughProvider(CredentialModel model)
Deprecated.- Specified by:
createCredentialThroughProvider
in interfaceSubjectCredentialManager
-
-