Class CredentialResetBase
- java.lang.Object
-
- pl.edu.icm.unity.stdext.credential.CredentialResetBase
-
- All Implemented Interfaces:
pl.edu.icm.unity.engine.api.authn.CredentialReset
- Direct Known Subclasses:
PasswordCredentialResetImpl,SMSCredentialResetImpl
public abstract class CredentialResetBase extends Object implements pl.edu.icm.unity.engine.api.authn.CredentialReset
Base for credential reset implementation ofCredentialReset. This implementation is stateful, i.e. from creation it must be used exclusively by a single reset procedure.- Author:
- P. Piernik
-
-
Field Summary
Fields Modifier and Type Field Description static DurationDEFAULT_MAX_CODE_VALIDITYprotected static intMAX_ANSWER_ATTEMPTSprotected pl.edu.icm.unity.engine.api.authn.EntityWithCredentialresolved
-
Constructor Summary
Constructors Constructor Description CredentialResetBase(pl.edu.icm.unity.engine.api.notification.NotificationProducer notificationProducer, pl.edu.icm.unity.engine.api.identity.IdentityResolver identityResolver, pl.edu.icm.unity.engine.api.authn.local.LocalCredentialVerificator localVerificator, pl.edu.icm.unity.engine.api.authn.local.CredentialHelper credentialHelper, String credentialId, com.fasterxml.jackson.databind.node.ObjectNode completeCredentialConfiguration, Duration maxCodeValidity)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected booleancheckSubject()protected abstract intgetCodeLength()StringgetCredentialConfiguration()protected abstract StringgetCredentialSettings()LonggetEntityId()protected pl.edu.icm.unity.engine.api.authn.AuthenticationSubjectgetRequestedSubject()StringgetSecurityQuestion()StringgetSentCode()StringgetSettings()voidsendCode(String msgTemplate, boolean onlyNumberCode)voidsetSubject(pl.edu.icm.unity.engine.api.authn.AuthenticationSubject subject, String[] idTypes)voidupdateCredential(String newCredential)voidverifyDynamicData(String answer)voidverifyStaticData(String answer)
-
-
-
Field Detail
-
MAX_ANSWER_ATTEMPTS
protected static final int MAX_ANSWER_ATTEMPTS
- See Also:
- Constant Field Values
-
DEFAULT_MAX_CODE_VALIDITY
public static final Duration DEFAULT_MAX_CODE_VALIDITY
-
resolved
protected pl.edu.icm.unity.engine.api.authn.EntityWithCredential resolved
-
-
Constructor Detail
-
CredentialResetBase
public CredentialResetBase(pl.edu.icm.unity.engine.api.notification.NotificationProducer notificationProducer, pl.edu.icm.unity.engine.api.identity.IdentityResolver identityResolver, pl.edu.icm.unity.engine.api.authn.local.LocalCredentialVerificator localVerificator, pl.edu.icm.unity.engine.api.authn.local.CredentialHelper credentialHelper, String credentialId, com.fasterxml.jackson.databind.node.ObjectNode completeCredentialConfiguration, Duration maxCodeValidity)
-
-
Method Detail
-
setSubject
public void setSubject(pl.edu.icm.unity.engine.api.authn.AuthenticationSubject subject, String[] idTypes)
-
checkSubject
protected boolean checkSubject()
-
getEntityId
public Long getEntityId()
- Specified by:
getEntityIdin interfacepl.edu.icm.unity.engine.api.authn.CredentialReset
-
getSettings
public String getSettings()
- Specified by:
getSettingsin interfacepl.edu.icm.unity.engine.api.authn.CredentialReset
-
getCredentialSettings
protected abstract String getCredentialSettings()
-
getRequestedSubject
protected pl.edu.icm.unity.engine.api.authn.AuthenticationSubject getRequestedSubject()
-
getSecurityQuestion
public String getSecurityQuestion()
- Specified by:
getSecurityQuestionin interfacepl.edu.icm.unity.engine.api.authn.CredentialReset
-
verifyStaticData
public void verifyStaticData(String answer) throws pl.edu.icm.unity.exceptions.WrongArgumentException, pl.edu.icm.unity.exceptions.IllegalIdentityValueException, pl.edu.icm.unity.exceptions.TooManyAttempts
- Specified by:
verifyStaticDatain interfacepl.edu.icm.unity.engine.api.authn.CredentialReset- Throws:
pl.edu.icm.unity.exceptions.WrongArgumentExceptionpl.edu.icm.unity.exceptions.IllegalIdentityValueExceptionpl.edu.icm.unity.exceptions.TooManyAttempts
-
getCodeLength
protected abstract int getCodeLength()
-
sendCode
public void sendCode(String msgTemplate, boolean onlyNumberCode) throws pl.edu.icm.unity.exceptions.EngineException
- Specified by:
sendCodein interfacepl.edu.icm.unity.engine.api.authn.CredentialReset- Throws:
pl.edu.icm.unity.exceptions.EngineException
-
getSentCode
public String getSentCode()
-
verifyDynamicData
public void verifyDynamicData(String answer) throws pl.edu.icm.unity.exceptions.WrongArgumentException, pl.edu.icm.unity.exceptions.TooManyAttempts
- Specified by:
verifyDynamicDatain interfacepl.edu.icm.unity.engine.api.authn.CredentialReset- Throws:
pl.edu.icm.unity.exceptions.WrongArgumentExceptionpl.edu.icm.unity.exceptions.TooManyAttempts
-
getCredentialConfiguration
public String getCredentialConfiguration()
- Specified by:
getCredentialConfigurationin interfacepl.edu.icm.unity.engine.api.authn.CredentialReset
-
updateCredential
public void updateCredential(String newCredential) throws pl.edu.icm.unity.exceptions.EngineException
- Specified by:
updateCredentialin interfacepl.edu.icm.unity.engine.api.authn.CredentialReset- Throws:
pl.edu.icm.unity.exceptions.EngineException
-
-