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 inicio de sesión y registro passkey/WebAuthn sin contraseña que emite JavaScript basado en SimpleWebAuthn, en Delphi, C++ Builder y .NET.
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.
TsgcHTMLComponent_WebAuthnLogin
Marcado de Bootstrap 5 + JS de WebAuthn
Delphi, C++ Builder, .NET
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
Los miembros que más vas a usar.
Build(aMode, aRegisterURL, aAuthenticateURL) renderiza el widget completo en una sola llamada, con valores por defecto sensatos para el modo y los endpoints.
Mode selecciona wamRegister, wamAuthenticate o wamBoth, decidiendo qué botones aparecen.
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.
RegisterButtonText, AuthenticateButtonText, RegisterButtonStyle, AuthenticateButtonStyle, Title, Description y ShowPasskeyIcon dan forma a la interfaz.
UsernameSelector lee el nombre de usuario de un campo antes de registrar; CustomScript reemplaza por completo el JavaScript SimpleWebAuthn integrado.
HTML devuelve el marcado más el <script> en línea usando SimpleWebAuthnBrowser; las alertas usan SuccessAlertStyle / ErrorAlertStyle.