WebAuthnLogin
TsgcHTMLComponent_WebAuthnLogin — un widget di login e registrazione senza password con passkey/WebAuthn che emette JavaScript basato su SimpleWebAuthn, in Delphi, C++ Builder e .NET.
TsgcHTMLComponent_WebAuthnLogin — un widget di login e registrazione senza password con passkey/WebAuthn che emette JavaScript basato su SimpleWebAuthn, in Delphi, C++ Builder e .NET.
Un widget passkey che renderizza i pulsanti di registrazione e accesso più lo script lato browser. Comunica con i tuoi endpoint /options e /verify tramite SimpleWebAuthnBrowser. Imposta la modalità e gli URL, quindi leggi HTML — oppure usa l’helper statico Build.
TsgcHTMLComponent_WebAuthnLogin
Bootstrap 5 markup + WebAuthn JS
Delphi, C++ Builder, .NET
L’helper statico Build renderizza il widget con una sola chiamata. Usa il componente completo quando ti serve un titolo personalizzato, un selettore di nome utente o un tuo 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
I membri che utilizzerai più spesso.
Build(aMode, aRegisterURL, aAuthenticateURL) renderizza l’intero widget con una sola chiamata, con valori predefiniti ragionevoli per la modalità e gli endpoint.
Mode seleziona wamRegister, wamAuthenticate o wamBoth, decidendo quali pulsanti compaiono.
RegisterURL e AuthenticateURL sono le basi del tuo server (lo script aggiunge /options e /verify); CallbackURL è dove atterra un accesso riuscito.
RegisterButtonText, AuthenticateButtonText, RegisterButtonStyle, AuthenticateButtonStyle, Title, Description e ShowPasskeyIcon modellano l’interfaccia.
UsernameSelector legge il nome utente da un campo prima della registrazione; CustomScript sostituisce interamente il JavaScript SimpleWebAuthn integrato.
HTML restituisce il markup più lo <script> inline che usa SimpleWebAuthnBrowser; gli avvisi usano SuccessAlertStyle / ErrorAlertStyle.