Der Server antwortet auf die Registrierungsoptionsanfrage des Clients (z. B. POST /sgcWebAuthn/Registration/Options) mit einer JSON-Nutzlast, die wie folgt aussieht (nach base64url-Kodierung der Binärfelder):
{
"publicKey": {
"rp": {
"name": "esegece software",
"id": "esegece.com"
},
"user": {
"id": "c3ViamVjdC1pZA", // base64url-encoded ArrayBuffer (user handle)
"name": "webauthn@esegece.com",
"displayName": "Delphi Developer"
},
"challenge": "Xz8x2K6nY3gZ...", // base64url-encoded challenge
"pubKeyCredParams": [
{ "type": "public-key", "alg": -7 }, // ES256
{ "type": "public-key", "alg": -257 } // RS256
],
"timeout": 60000,
"attestation": "none",
"authenticatorSelection": {
"authenticatorAttachment": "platform",
"userVerification": "preferred",
"residentKey": "discouraged"
}
}
}
Nachfolgend finden Sie eine Beschreibung der Felder:
Bevor die Antwort an den Client gesendet wird, wird das Ereignis OnWebAuthnRegistrationOptionsResponse aufgerufen, sodass Sie die Antwort anpassen können.
procedure OnWebAuthnRegistrationOptionsResponse(Sender: TObject; const aRequest: TsgcWebAuthn_RegistrationOptions_Request; const aResponse: TsgcWebAuthn_RegistrationOptions_Response);
begin
if aRequest.Username = 'esegece.com' then
begin
aResponse.ExcludeCredentials.AddCredentialRecordFromJSON('json1.txt');
aResponse.ExcludeCredentials.AddCredentialRecordFromJSON('json2.txt');
end;
end;