TsgcWSAPIServer_WebAuthn › Events › OnWebAuthnHTTPRequest
Dispara antes que um endpoint WebAuthn processe uma requisição HTTP recebida; permite que a aplicação inspecione cabeçalhos, aplique limites de taxa ou rejeite a chamada.
property OnWebAuthnHTTPRequest: TsgcWebAuthnOnHTTPRequest;
// TsgcWebAuthnOnHTTPRequest = procedure(Sender: TObject; aMethod: TsgcWebAuthnHTTPRequestMethod; const aRequest: TsgcHTTPRequest; var Accept: Boolean) of object
—
Chamado uma vez por acesso HTTP a qualquer endpoint WebAuthn. aMethod identifica qual endpoint foi correspondido (registration options/verify ou authentication options/verify), aRequest expõe os cabeçalhos HTTP brutos e o payload, e Accept tem como padrão true. Defina Accept como false para curto-circuitar o pipeline (por exemplo, ao fazer throttling de clientes ou impor allowlists de IP) — o servidor então ignorará a lógica WebAuthn para essa chamada.
procedure TForm1.sgcWSAPIServer_WebAuthn1WebAuthnHTTPRequest(Sender: TObject;
aMethod: TsgcWebAuthnHTTPRequestMethod; const aRequest: TsgcHTTPRequest;
var Accept: Boolean);
begin
Memo1.Lines.Add('WebAuthn request from ' + aRequest.RemoteIP);
if IsBlocked(aRequest.RemoteIP) then
Accept := False;
end;