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 forCredentialInputUpdaters andCredentialInputValidators.- 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 CredentialModelcreateCredentialThroughProvider(CredentialModel model)Deprecated.CredentialModelcreateStoredCredential(CredentialModel cred)Updates a credential of the entity with an updatedCredentialModel.voiddisableCredentialType(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.CredentialModelgetStoredCredentialById(String id)Read a stored credential.CredentialModelgetStoredCredentialByNameAndType(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.booleanisConfiguredFor(String type)Check if the credential type is configured for this entity.booleanisConfiguredLocally(String type)Deprecated.booleanisValid(List<CredentialInput> inputs)Validate a list of credentials.booleanmoveStoredCredentialTo(String id, String newPreviousCredentialId)Re-order the stored credentials.booleanremoveStoredCredentialById(String id)Updates a credential of the entity with an updatedCredentialModel.booleanupdateCredential(CredentialInput input)Updates a credential of the entity with the inputs provided by the entity.voidupdateCredentialLabel(String credentialId, String userLabel)Update the label for a stored credentials chosen by the owner of the entity.voidupdateStoredCredential(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:SubjectCredentialManagerValidate a list of credentials.- Specified by:
isValidin interfaceSubjectCredentialManager- Returns:
trueif inputs are valid
-
updateCredential
public boolean updateCredential(CredentialInput input)
Description copied from interface:SubjectCredentialManagerUpdates a credential of the entity with the inputs provided by the entity.- Specified by:
updateCredentialin interfaceSubjectCredentialManager- Returns:
trueif credentials have been updated successfully
-
updateStoredCredential
public void updateStoredCredential(CredentialModel cred)
Description copied from interface:SubjectCredentialManagerUpdates a credential of the entity with an updatedCredentialModel. Usually called by aCredentialProvider.- Specified by:
updateStoredCredentialin interfaceSubjectCredentialManager
-
createStoredCredential
public CredentialModel createStoredCredential(CredentialModel cred)
Description copied from interface:SubjectCredentialManagerUpdates a credential of the entity with an updatedCredentialModel. Usually called by aCredentialProvider.- Specified by:
createStoredCredentialin interfaceSubjectCredentialManager
-
removeStoredCredentialById
public boolean removeStoredCredentialById(String id)
Description copied from interface:SubjectCredentialManagerUpdates 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:
removeStoredCredentialByIdin interfaceSubjectCredentialManager
-
getStoredCredentialById
public CredentialModel getStoredCredentialById(String id)
Description copied from interface:SubjectCredentialManagerRead a stored credential.- Specified by:
getStoredCredentialByIdin interfaceSubjectCredentialManager
-
getStoredCredentialsStream
public Stream<CredentialModel> getStoredCredentialsStream()
Description copied from interface:SubjectCredentialManagerRead stored credentials as a stream.- Specified by:
getStoredCredentialsStreamin interfaceSubjectCredentialManager
-
getStoredCredentialsByTypeStream
public Stream<CredentialModel> getStoredCredentialsByTypeStream(String type)
Description copied from interface:SubjectCredentialManagerRead stored credentials by type as a stream.- Specified by:
getStoredCredentialsByTypeStreamin interfaceSubjectCredentialManager
-
getStoredCredentialByNameAndType
public CredentialModel getStoredCredentialByNameAndType(String name, String type)
- Specified by:
getStoredCredentialByNameAndTypein interfaceSubjectCredentialManager
-
moveStoredCredentialTo
public boolean moveStoredCredentialTo(String id, String newPreviousCredentialId)
Description copied from interface:SubjectCredentialManagerRe-order the stored credentials.- Specified by:
moveStoredCredentialToin interfaceSubjectCredentialManager
-
updateCredentialLabel
public void updateCredentialLabel(String credentialId, String userLabel)
Description copied from interface:SubjectCredentialManagerUpdate the label for a stored credentials chosen by the owner of the entity.- Specified by:
updateCredentialLabelin interfaceSubjectCredentialManager
-
disableCredentialType
public void disableCredentialType(String credentialType)
Description copied from interface:SubjectCredentialManagerDisable a credential by type.- Specified by:
disableCredentialTypein interfaceSubjectCredentialManager
-
getDisableableCredentialTypesStream
public Stream<String> getDisableableCredentialTypesStream()
Description copied from interface:SubjectCredentialManagerList the credentials that can be disabled, for example, to show the list to the entity (aka user) or an admin.- Specified by:
getDisableableCredentialTypesStreamin interfaceSubjectCredentialManager- Returns:
- stream with credential types that can be disabled
-
isConfiguredFor
public boolean isConfiguredFor(String type)
Description copied from interface:SubjectCredentialManagerCheck if the credential type is configured for this entity.- Specified by:
isConfiguredForin interfaceSubjectCredentialManager- Parameters:
type- credential type to check- Returns:
trueif the credential type has been
-
isConfiguredLocally
@Deprecated public boolean isConfiguredLocally(String type)
Deprecated.- Specified by:
isConfiguredLocallyin interfaceSubjectCredentialManager
-
getConfiguredUserStorageCredentialTypesStream
@Deprecated public Stream<String> getConfiguredUserStorageCredentialTypesStream()
Deprecated.- Specified by:
getConfiguredUserStorageCredentialTypesStreamin interfaceSubjectCredentialManager
-
createCredentialThroughProvider
@Deprecated public CredentialModel createCredentialThroughProvider(CredentialModel model)
Deprecated.- Specified by:
createCredentialThroughProviderin interfaceSubjectCredentialManager
-
-