TsgcWSAPIServer_WebAuthnEvents › OnWebAuthnHTTPRequest

OnWebAuthnHTTPRequest 事件

在 WebAuthn 端点处理传入的 HTTP 请求之前触发;允许应用程序检查标头、应用速率限制或拒绝调用。

语法

property OnWebAuthnHTTPRequest: TsgcWebAuthnOnHTTPRequest;
// TsgcWebAuthnOnHTTPRequest = procedure(Sender: TObject; aMethod: TsgcWebAuthnHTTPRequestMethod; const aRequest: TsgcHTTPRequest; var Accept: Boolean) of object

默认值

备注

每次对任意 WebAuthn 端点的 HTTP 请求时调用一次。aMethod 标识匹配的端点(注册选项/验证或身份验证选项/验证),aRequest 暴露原始 HTTP 头和载荷,Accept 默认为 true。将 Accept 设为 false 可短路流程(例如对客户端进行限流或执行 IP 白名单),服务器将跳过该调用的 WebAuthn 逻辑。

示例

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;

返回事件