TsgcWSAPIServer_WebAuthnEvents › OnWebAuthnRegistrationOptionsRequest

OnWebAuthnRegistrationOptionsRequest Event

Fires at the start of /register/begin when a client asks for PublicKeyCredentialCreationOptions; lets the application validate the user and approve or reject the ceremony.

Syntax

property OnWebAuthnRegistrationOptionsRequest: TsgcWebAuthnOnRegistrationOptionsRequest;
// TsgcWebAuthnOnRegistrationOptionsRequest = procedure(Sender: TObject; const aRequest: TsgcWebAuthn_RegistrationOptions_Request; var Accept: Boolean) of object

Default Value

Remarks

First hook of the registration ceremony (WebAuthn navigator.credentials.create()). aRequest contains the username, display name and client-supplied preferences. Accept defaults to true; set it to false to cancel the ceremony (for example when the username is already registered, the user is not allowed to enroll more credentials, or the request must be throttled). When accepted, the server generates the challenge and fires OnWebAuthnRegistrationOptionsResponse.

Example

procedure TForm1.sgcWSAPIServer_WebAuthn1WebAuthnRegistrationOptionsRequest(
  Sender: TObject; const aRequest: TsgcWebAuthn_RegistrationOptions_Request;
  var Accept: Boolean);
begin
  if UserExists(aRequest.User.Name) then
    Accept := False
  else
    Accept := True;
end;

Back to Events