Class VerifyTotpUseCase
java.lang.Object
com.irurueta.authserver.authorization.application.totp.VerifyTotpUseCase
Use case that verifies a TOTP code presented as a second factor: ±1 step window, no replay of a step already used,
lockout after repeated failures, and an audit event either way.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final CheckSecondFactorLockoutUseCaseUse case that tells whether the second factor is locked.private final ClockSource of the current time.private final RecordSecurityEventUseCaseUse case that records the audit events.private final RegisterSecondFactorFailureUseCaseUse case that counts a failure.private final ResetSecondFactorFailuresUseCaseUse case that clears the failures.private final TotpAlgorithmThe TOTP algorithm.private final TotpCredentialRepositoryPort that stores the TOTP credentials.private final TotpSecretCipherPort that decrypts the secrets. -
Constructor Summary
Constructors -
Method Summary
-
Field Details
-
totpCredentialRepository
Port that stores the TOTP credentials. -
totpSecretCipher
Port that decrypts the secrets. -
totpAlgorithm
The TOTP algorithm. -
checkSecondFactorLockoutUseCase
Use case that tells whether the second factor is locked. -
registerSecondFactorFailureUseCase
Use case that counts a failure. -
resetSecondFactorFailuresUseCase
Use case that clears the failures. -
recordSecurityEventUseCase
Use case that records the audit events. -
clock
Source of the current time.
-
-
Constructor Details
-
VerifyTotpUseCase
public VerifyTotpUseCase()
-
-
Method Details
-
execute
Verifies a code.- Parameters:
userId- identifier of the user.username- name of the user, for the audit log.code- the code as typed.- Returns:
trueif the code is valid and fresh.- Throws:
SecondFactorLockedException- if the second factor of the user is locked.
-