WebAuthnLogin

TsgcHTMLComponent_WebAuthnLogin — um widget de login e registro passkey/WebAuthn sem senha que emite JavaScript baseado em SimpleWebAuthn, em Delphi, C++ Builder e .NET.

TsgcHTMLComponent_WebAuthnLogin

Um widget de passkey que renderiza botões de registro e login mais o script do lado do navegador. Ele se comunica com seus endpoints /options e /verify através do SimpleWebAuthnBrowser. Defina o modo e as URLs e então leia HTML — ou use o helper estático Build.

Classe do componente

TsgcHTMLComponent_WebAuthnLogin

Renderiza

Markup Bootstrap 5 + JS WebAuthn

Família

Autenticação

Linguagens

Delphi, C++ Builder, .NET

Uma linha, ou controle total

O helper estático Build renderiza o widget em uma única chamada. Use o componente completo quando precisar de um título personalizado, seletor de usuário ou seu próprio 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

Principais propriedades & métodos

Os membros que você usa com mais frequência.

Construtor estático

Build(aMode, aRegisterURL, aAuthenticateURL) renderiza o widget inteiro em uma chamada, com padrões sensatos para o modo e os endpoints.

Modo

Mode seleciona wamRegister, wamAuthenticate ou wamBoth, decidindo quais botões aparecem.

Endpoints

RegisterURL e AuthenticateURL são as bases do seu servidor (o script anexa /options e /verify); CallbackURL é onde um login bem-sucedido leva.

Botões & texto

RegisterButtonText, AuthenticateButtonText, RegisterButtonStyle, AuthenticateButtonStyle, Title, Description e ShowPasskeyIcon moldam a UI.

Script & usuário

UsernameSelector lê o nome de usuário de um campo antes de registrar; CustomScript substitui inteiramente o JavaScript SimpleWebAuthn embutido.

Saída

HTML retorna o markup mais o <script> inline usando SimpleWebAuthnBrowser; os alertas usam SuccessAlertStyle / ErrorAlertStyle.

Continue explorando

Todos os Componentes sgcHTMLExplore a matriz completa de recursos com mais de 60 componentes.
Baixar Versão de Avaliação GratuitaA avaliação de 30 dias inclui os projetos de demonstração 60.HTML.
PreçosLicenças Single, Team e Site com código-fonte completo.

Pronto para Começar?

Baixe a versão de avaliação gratuita e adicione login por passkey à sua aplicação web Delphi, C++ Builder ou .NET.