WebAuthn Authentication | Richiesta

Quando un utente tenta di accedere, il browser invia una richiesta al server chiedendo le opzioni di autenticazione (chiamate anche "assertion options").

 

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

 

Questa richiesta consente al server di:

 

 

Quando il componente server WebAuthn riceve questa richiesta, tipicamente effettuata tramite una richiesta HTTPS POST dal browser a un endpoint server (ad es. /sgcWebAuthn/Authentication/Options), viene chiamato l'evento OnWebAuthnAuthenticationOptionsRequest, così è possibile aggiungere le credenziali associate al nome utente (se presenti).

 


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;