WebAuthn 认证 | 请求

当用户尝试登录时,浏览器向服务器发送请求,要求获取身份验证选项(也称为"断言选项")。

 

{
"username": "alice@example.com"
}

 

此请求允许服务器:

 

 

当 WebAuthn 服务器组件收到此请求时(通常通过浏览器向服务器端点(例如 /sgcWebAuthn/Authentication/Options)的 HTTPS POST 请求完成),事件 OnWebAuthnAuthenticationOptionsRequest 被调用,您可以在此添加与用户名关联的凭据(如有)。

 


procedure OnWebAuthnAuthenticationOptionsRequest(
    Sender: TObject; const aRequest:
    TsgcWebAuthn_AuthenticationOptions_Request; var CredentialRecords:
    TsgcWebAuthn_CredentialRecords; var Accept: Boolean);
begin
  if UserExistsInDB(aRequest.Username) then
  begin
    While not EOF do
    begin
      CredentialRecords.AddCredentialRecordFromJSON(RecordFromDB);
      Next;
    end;
  end;
end;