ユーザーがログインを試みると、ブラウザーはサーバーに認証オプション(「assertion options」とも呼ばれます)を求めるリクエストを送信します。
{
"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;