Table of Contents

Class ReCaptchaEnterpriseVerifier

Namespace
NuvTools.Security.AspNetCore.Captcha
Assembly
NuvTools.Security.AspNetCore.dll

Verifies a reCAPTCHA Enterprise token by creating an assessment on the Google Cloud API (recaptchaenterprise.googleapis.com). The API key never leaves the server.

public sealed class ReCaptchaEnterpriseVerifier : ICaptchaVerifier
Inheritance
ReCaptchaEnterpriseVerifier
Implements
Inherited Members

Constructors

ReCaptchaEnterpriseVerifier(HttpClient, IOptions<CaptchaOptions>, ILogger<ReCaptchaEnterpriseVerifier>)

Verifies a reCAPTCHA Enterprise token by creating an assessment on the Google Cloud API (recaptchaenterprise.googleapis.com). The API key never leaves the server.

public ReCaptchaEnterpriseVerifier(HttpClient httpClient, IOptions<CaptchaOptions> options, ILogger<ReCaptchaEnterpriseVerifier> logger)

Parameters

httpClient HttpClient

Client used to call the assessment API.

options IOptions<CaptchaOptions>

CAPTCHA configuration.

logger ILogger<ReCaptchaEnterpriseVerifier>

Logger for diagnostics.

Methods

VerifyAsync(string?, bool, CancellationToken)

Creates an assessment for the token.

public Task<CaptchaVerification> VerifyAsync(string? token, bool checkboxMode, CancellationToken cancellationToken = default)

Parameters

token string

The token produced by the client.

checkboxMode bool

true uses the checkbox key (step-up challenge); false uses the score key (invisible).

cancellationToken CancellationToken

Token to cancel the operation.

Returns

Task<CaptchaVerification>

The verification result. An empty token or a communication failure yields Valid = false (fail-closed).