Componente WebAuthnLogin — sgcHTML | eSeGeCe

WebAuthnLogin

TsgcHTMLComponent_WebAuthnLogin — un widget de inicio de sesión y registro passkey/WebAuthn sin contraseña que emite JavaScript basado en SimpleWebAuthn, en Delphi, C++ Builder y .NET.

TsgcHTMLComponent_WebAuthnLogin

Un widget de passkey que renderiza botones de registro e inicio de sesión más el script del lado del navegador. Habla con tus endpoints /options y /verify a través de SimpleWebAuthnBrowser. Define el modo y las URLs y luego lee HTML — o usa la ayuda estática Build.

Clase de componente

TsgcHTMLComponent_WebAuthnLogin

Renderiza

Marcado de Bootstrap 5 + JS de WebAuthn

Familia

Autenticación

Lenguajes

Delphi, C++ Builder, .NET

Una línea, o control total

La ayuda estática Build renderiza el widget en una sola llamada. Usa el componente completo cuando necesites un título personalizado, un selector de usuario o tu propio script.

uses
  sgcHTML_Enums, sgcHTML_Component_WebAuthnLogin;

// One-liner (register + authenticate, default endpoints):
WebModule.Response := TsgcHTMLComponent_WebAuthnLogin.Build(
  wamBoth, '/webauthn/register', '/webauthn/authenticate');

// Full control:
var
  oWA: TsgcHTMLComponent_WebAuthnLogin;
begin
  oWA := TsgcHTMLComponent_WebAuthnLogin.Create(nil);
  try
    oWA.Mode := wamBoth;
    oWA.RegisterURL := '/webauthn/register';
    oWA.AuthenticateURL := '/webauthn/authenticate';
    oWA.CallbackURL := '/dashboard';
    oWA.Title := 'Passwordless sign-in';
    oWA.ShowPasskeyIcon := True;
    oWA.UsernameSelector := '#username';

    WebModule.Response := oWA.HTML;   // buttons + SimpleWebAuthn JS
  finally
    oWA.Free;
  end;
end;
// includes: sgcHTML_Enums.hpp, sgcHTML_Component_WebAuthnLogin.hpp

// One-liner (register + authenticate, default endpoints):
String html = TsgcHTMLComponent_WebAuthnLogin::Build(
  wamBoth, "/webauthn/register", "/webauthn/authenticate");

// Full control:
TsgcHTMLComponent_WebAuthnLogin *oWA = new TsgcHTMLComponent_WebAuthnLogin(NULL);
try
{
  oWA->Mode = wamBoth;
  oWA->RegisterURL = "/webauthn/register";
  oWA->AuthenticateURL = "/webauthn/authenticate";
  oWA->CallbackURL = "/dashboard";
  oWA->Title = "Passwordless sign-in";
  oWA->ShowPasskeyIcon = true;
  oWA->UsernameSelector = "#username";

  String full = oWA->HTML;   // buttons + SimpleWebAuthn JS
}
__finally
{
  delete oWA;
}
using esegece.sgcWebSockets;

// One-liner (register + authenticate, default endpoints):
string html = TsgcHTMLComponent_WebAuthnLogin.Build(
    TsgcHTMLWebAuthnMode.wamBoth, "/webauthn/register", "/webauthn/authenticate");

// Full control:
var wa = new TsgcHTMLComponent_WebAuthnLogin();
wa.Mode = TsgcHTMLWebAuthnMode.wamBoth;
wa.RegisterURL = "/webauthn/register";
wa.AuthenticateURL = "/webauthn/authenticate";
wa.CallbackURL = "/dashboard";
wa.Title = "Passwordless sign-in";
wa.ShowPasskeyIcon = true;
wa.UsernameSelector = "#username";

string full = wa.HTML;   // buttons + SimpleWebAuthn JS

Propiedades y métodos clave

Los miembros que más vas a usar.

Constructor estático

Build(aMode, aRegisterURL, aAuthenticateURL) renderiza el widget completo en una sola llamada, con valores por defecto sensatos para el modo y los endpoints.

Modo

Mode selecciona wamRegister, wamAuthenticate o wamBoth, decidiendo qué botones aparecen.

Endpoints

RegisterURL y AuthenticateURL son las bases de tu servidor (el script añade /options y /verify); CallbackURL es a dónde llega un inicio de sesión correcto.

Botones y texto

RegisterButtonText, AuthenticateButtonText, RegisterButtonStyle, AuthenticateButtonStyle, Title, Description y ShowPasskeyIcon dan forma a la interfaz.

Script y usuario

UsernameSelector lee el nombre de usuario de un campo antes de registrar; CustomScript reemplaza por completo el JavaScript SimpleWebAuthn integrado.

Salida

HTML devuelve el marcado más el <script> en línea usando SimpleWebAuthnBrowser; las alertas usan SuccessAlertStyle / ErrorAlertStyle.

Sigue explorando

Ayuda en líneaReferencia completa de la API y guía de uso para este componente.
Todos los componentes sgcHTMLExplora la matriz completa de más de 60 componentes.
Descargar prueba gratuitaLa prueba de 30 días incluye los proyectos demo 60.HTML.
PreciosLicencias Single, Team y Site con código fuente completo.

¿Listo para empezar?

Descarga la prueba gratuita y añade inicio de sesión con passkey a tu aplicación web Delphi, C++ Builder o .NET.