TsgcWSAPIServer_WebAuthn事件 › OnWebAuthnRegistrationValidateCredentialId

OnWebAuthnRegistrationValidateCredentialId 事件

在 /register/verify 期间触发,让应用程序检查新凭据 id 在其用户存储中是否唯一。

语法

property OnWebAuthnRegistrationValidateCredentialId: TsgcWebAuthnOnRegistrationValidateCredentialId;
// TsgcWebAuthnOnRegistrationValidateCredentialId = procedure(Sender: TObject; const aCredentialId: String; var Accept: Boolean) of object

默认值

备注

在验证签名验证响应时触发,发生在凭据被接受之前。aCredentialId 是验证器生成的 base64url 编码的凭据 ID。如果应用程序已知晓该凭据 ID(碰撞、重放攻击、凭据被盗等情况),请将 Accept 设置为 false,服务器将以验证错误拒绝注册。使用此事件可基于您的用户数据库实施全局唯一性约束。

示例

procedure TForm1.sgcWSAPIServer_WebAuthn1WebAuthnRegistrationValidateCredentialId(
  Sender: TObject; const aCredentialId: String; var Accept: Boolean);
begin
  Accept := not CredentialExists(aCredentialId);
end;

返回事件