Package org.keycloak.credential
Class PasswordCredentialProvider
- java.lang.Object
-
- org.keycloak.credential.PasswordCredentialProvider
-
- All Implemented Interfaces:
CredentialInputUpdater
,CredentialInputValidator
,CredentialProvider<PasswordCredentialModel>
,Provider
public class PasswordCredentialProvider extends Object implements CredentialProvider<PasswordCredentialModel>, CredentialInputUpdater, CredentialInputValidator
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.keycloak.credential.CredentialInputUpdater
CredentialInputUpdater.Streams
-
-
Field Summary
Fields Modifier and Type Field Description protected KeycloakSession
session
-
Constructor Summary
Constructors Constructor Description PasswordCredentialProvider(KeycloakSession session)
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.keycloak.credential.CredentialProvider
close, getCredentialMetadata, getDefaultCredential
-
-
-
-
Field Detail
-
session
protected final KeycloakSession session
-
-
Constructor Detail
-
PasswordCredentialProvider
public PasswordCredentialProvider(KeycloakSession session)
-
-
Method Detail
-
getPassword
public PasswordCredentialModel getPassword(RealmModel realm, UserModel user)
-
createCredential
public boolean createCredential(RealmModel realm, UserModel user, String password)
-
createCredential
public CredentialModel createCredential(RealmModel realm, UserModel user, PasswordCredentialModel credentialModel)
- Specified by:
createCredential
in interfaceCredentialProvider<PasswordCredentialModel>
-
deleteCredential
public boolean deleteCredential(RealmModel realm, UserModel user, String credentialId)
- Specified by:
deleteCredential
in interfaceCredentialProvider<PasswordCredentialModel>
-
getCredentialFromModel
public PasswordCredentialModel getCredentialFromModel(CredentialModel model)
- Specified by:
getCredentialFromModel
in interfaceCredentialProvider<PasswordCredentialModel>
-
getHashProvider
protected PasswordHashProvider getHashProvider(PasswordPolicy policy)
-
supportsCredentialType
public boolean supportsCredentialType(String credentialType)
- Specified by:
supportsCredentialType
in interfaceCredentialInputUpdater
- Specified by:
supportsCredentialType
in interfaceCredentialInputValidator
-
updateCredential
public boolean updateCredential(RealmModel realm, UserModel user, CredentialInput input)
- Specified by:
updateCredential
in interfaceCredentialInputUpdater
-
disableCredentialType
public void disableCredentialType(RealmModel realm, UserModel user, String credentialType)
- Specified by:
disableCredentialType
in interfaceCredentialInputUpdater
-
getDisableableCredentialTypesStream
public Stream<String> getDisableableCredentialTypesStream(RealmModel realm, UserModel user)
Description copied from interface:CredentialInputUpdater
Obtains the set of credential types that can be disabled viadisableCredentialType
.- Specified by:
getDisableableCredentialTypesStream
in interfaceCredentialInputUpdater
- Parameters:
realm
- a reference to the realm.user
- the user whose credentials are being searched.- Returns:
- a non-null
Stream
of credential types.
-
isConfiguredFor
public boolean isConfiguredFor(RealmModel realm, UserModel user, String credentialType)
- Specified by:
isConfiguredFor
in interfaceCredentialInputValidator
-
isValid
public boolean isValid(RealmModel realm, UserModel user, CredentialInput input)
Description copied from interface:CredentialInputValidator
Tests whether a credential is valid- Specified by:
isValid
in interfaceCredentialInputValidator
- Parameters:
realm
- The realm in which to which the credential belongs touser
- The user for which to test the credentialinput
- the credential details to verify- Returns:
- true if the passed secret is correct
-
getType
public String getType()
- Specified by:
getType
in interfaceCredentialProvider<PasswordCredentialModel>
-
getCredentialTypeMetadata
public CredentialTypeMetadata getCredentialTypeMetadata(CredentialTypeMetadataContext metadataContext)
- Specified by:
getCredentialTypeMetadata
in interfaceCredentialProvider<PasswordCredentialModel>
-
-