Skip to content

Fortified IDDocs

OTP Validation

Validates a one-time password.

Use this valve to validate a generated one-time password suite1. On success, user_authenticated is set to "true" on the item. On failure, a PipeException is thrown — unless otp_retries is configured, in which case the valve soft-fails and lets the calling flow handle the error.

When otp_retries > 0, a failed validation resolves instead of throwing. The valve writes the current failure count and the configured limit to the item. The calling flow is responsible for persisting otp_fails from the item to the session between attempts — the valve reads the counter from the session to perform its pre-check.

Pre-check: at the start of each call, the valve reads otp_fails from the session. If the value is greater than or equal to otp_retries, the request is blocked without validating the OTP. By default the pre-check also soft-fails; set otp_strict: true to make it throw instead.

NameDescriptionDefault valueMandatoryExpanded
username_parameterParameter containing the username.N/A
otp_parameterParameter containing the entered OTP.N/A
src_parameterParameter containing the previously generated OTP."${session.generated_otp}"
otp_retriesMaximum number of accepted failures before the pre-check blocks the request. When 0, any failed OTP throws immediately.0
otp_strictWhen true, the pre-check throws a PipeException instead of soft-failing when the retry counter is exhausted.false
  1. A suite is the "full" one-time password value containing otp_value,creation_time,valid_time. ↩