VerificationResult

public abstract class VerificationResult extends Object

Immmutable object to hold the result of a verification operation. This object can be in three possible states:

Status Condition Expected results
Succeeded getVerificationStatus().equals(CommonStatusCodes.SUCCESS) In this state verificationHandle() will be absent but recaptchaToken() will not. The token can be used with the reCAPTCHA Enterprise server to verify that the account is indeed verified.
Aborted getVerificationStatus().equals(RecaptchaStatusCodes.RECAPTCHA_2FA_ABORTED) In this state verificationHandle() will be absent but recaptchaToken() will not. In this case reCAPTCHA server has aborted the operation, and more information on the reasons of the abortion can be obtained by calling the reCAPTCHA Enterprise server with the token.
Failed !getVerificationStatus().equals(CommonStatusCodes.SUCCESS) && !getVerificationStatus().equals(RecaptchaStatusCodes.RECAPTCHA_2FA_ABORTED) In this state recaptchaToken() will be absent but verificationHandle() will not, to allow for additional retries.

Public Constructor Summary

Public Method Summary

abstract Status
getVerificationStatus()
Returns a status to provide more info on the result of the verification operation.
abstract RecaptchaOptionalObject<String>
recaptchaToken()
Returns an optional containing the reCAPTCHA token if the verification operation was successful or aborted.
abstract RecaptchaOptionalObject<VerificationHandle>
verificationHandle()
Returns an optional containing a verification handle if the verification operation failed and the client is allowed to retry.

Inherited Method Summary

Public Constructors

public VerificationResult ()

Public Methods

public abstract Status getVerificationStatus ()

Returns a status to provide more info on the result of the verification operation.

Returns
  • CommonStatusCodes.SUCCESS or RecaptchaStatusCodes.RECAPTCHA_2FA_ABORTED status if the verification operation succeeded, and non-success status (e.g. RecaptchaStatusCodes.RECAPTCHA_2FA_PIN_MISMATCH) if the verification failed with more attempts available, i.e. user entered wrong pin.

public abstract RecaptchaOptionalObject<String> recaptchaToken ()

Returns an optional containing the reCAPTCHA token if the verification operation was successful or aborted.

Returns
  • the reCAPTCHA token if getVerificationStatus().equals( CommonStatusCodes.SUCCESS) or getVerificationStatus().equals( RecaptchaStatusCodes.RECAPTCHA_2FA_ABORTED), otherwise an empty RecaptchaOptionalObject.

public abstract RecaptchaOptionalObject<VerificationHandle> verificationHandle ()

Returns an optional containing a verification handle if the verification operation failed and the client is allowed to retry.

Returns