Package org.keycloak.credential
Class OTPCredentialProvider
- java.lang.Object
-
- org.keycloak.credential.OTPCredentialProvider
-
- All Implemented Interfaces:
CredentialInputValidator
,CredentialProvider<OTPCredentialModel>
,Provider
public class OTPCredentialProvider extends Object implements CredentialProvider<OTPCredentialModel>, CredentialInputValidator
- Version:
- $Revision: 1 $
- Author:
- Bill Burke
-
-
Field Summary
Fields Modifier and Type Field Description protected KeycloakSession
session
-
Constructor Summary
Constructors Constructor Description OTPCredentialProvider(KeycloakSession session)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CredentialModel
createCredential(RealmModel realm, UserModel user, OTPCredentialModel credentialModel)
boolean
deleteCredential(RealmModel realm, UserModel user, String credentialId)
OTPCredentialModel
getCredentialFromModel(CredentialModel model)
CredentialTypeMetadata
getCredentialTypeMetadata(CredentialTypeMetadataContext metadataContext)
String
getType()
boolean
isConfiguredFor(RealmModel realm, UserModel user)
boolean
isConfiguredFor(RealmModel realm, UserModel user, String credentialType)
boolean
isValid(RealmModel realm, UserModel user, CredentialInput credentialInput)
Tests whether a credential is validboolean
supportsCredentialType(String credentialType)
-
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 KeycloakSession session
-
-
Constructor Detail
-
OTPCredentialProvider
public OTPCredentialProvider(KeycloakSession session)
-
-
Method Detail
-
createCredential
public CredentialModel createCredential(RealmModel realm, UserModel user, OTPCredentialModel credentialModel)
- Specified by:
createCredential
in interfaceCredentialProvider<OTPCredentialModel>
-
deleteCredential
public boolean deleteCredential(RealmModel realm, UserModel user, String credentialId)
- Specified by:
deleteCredential
in interfaceCredentialProvider<OTPCredentialModel>
-
getCredentialFromModel
public OTPCredentialModel getCredentialFromModel(CredentialModel model)
- Specified by:
getCredentialFromModel
in interfaceCredentialProvider<OTPCredentialModel>
-
supportsCredentialType
public boolean supportsCredentialType(String credentialType)
- Specified by:
supportsCredentialType
in interfaceCredentialInputValidator
-
isConfiguredFor
public boolean isConfiguredFor(RealmModel realm, UserModel user, String credentialType)
- Specified by:
isConfiguredFor
in interfaceCredentialInputValidator
-
isConfiguredFor
public boolean isConfiguredFor(RealmModel realm, UserModel user)
-
isValid
public boolean isValid(RealmModel realm, UserModel user, CredentialInput credentialInput)
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 credentialcredentialInput
- the credential details to verify- Returns:
- true if the passed secret is correct
-
getType
public String getType()
- Specified by:
getType
in interfaceCredentialProvider<OTPCredentialModel>
-
getCredentialTypeMetadata
public CredentialTypeMetadata getCredentialTypeMetadata(CredentialTypeMetadataContext metadataContext)
- Specified by:
getCredentialTypeMetadata
in interfaceCredentialProvider<OTPCredentialModel>
-
-