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 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.

Classe del componente

TsgcHTMLComponent_WebAuthnLogin

Renderizza

Bootstrap 5 markup + WebAuthn JS

Famiglia

Autenticazione

Linguaggi

Delphi, C++ Builder, .NET

Una riga, o controllo completo

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

Proprietà e metodi principali

I membri che utilizzerai più spesso.

Builder statico

Build(aMode, aRegisterURL, aAuthenticateURL) renderizza l’intero widget con una sola chiamata, con valori predefiniti ragionevoli per la modalità e gli endpoint.

Modalità

Mode seleziona wamRegister, wamAuthenticate o wamBoth, decidendo quali pulsanti compaiono.

Endpoint

RegisterURL e AuthenticateURL sono le basi del tuo server (lo script aggiunge /options e /verify); CallbackURL è dove atterra un accesso riuscito.

Pulsanti e testo

RegisterButtonText, AuthenticateButtonText, RegisterButtonStyle, AuthenticateButtonStyle, Title, Description e ShowPasskeyIcon modellano l’interfaccia.

Script e nome utente

UsernameSelector legge il nome utente da un campo prima della registrazione; CustomScript sostituisce interamente il JavaScript SimpleWebAuthn integrato.

Output

HTML restituisce il markup più lo <script> inline che usa SimpleWebAuthnBrowser; gli avvisi usano SuccessAlertStyle / ErrorAlertStyle.

Continua a esplorare

Tutti i componenti sgcHTMLEsplora la matrice completa delle funzionalità di oltre 60 componenti.
Scarica la Prova GratuitaLa prova di 30 giorni include i progetti demo 60.HTML.
PrezziLicenze Single, Team e Site con codice sorgente completo.

Pronto a Iniziare?

Scarica la versione di prova gratuita e aggiungi il login con passkey alla tua app web in Delphi, C++ Builder o .NET.