WebAuthnLogin
TsgcHTMLComponent_WebAuthnLogin — Delphi、C++ Builder、.NET で、SimpleWebAuthn ベースの JavaScript を出力する、パスワードレスのパスキー/WebAuthn ログイン・登録ウィジェットです。
TsgcHTMLComponent_WebAuthnLogin — Delphi、C++ Builder、.NET で、SimpleWebAuthn ベースの JavaScript を出力する、パスワードレスのパスキー/WebAuthn ログイン・登録ウィジェットです。
登録ボタンとサインインボタン、およびブラウザー側のスクリプトをレンダリングするパスキーウィジェットです。SimpleWebAuthnBrowser を介して、お使いの /options と /verify エンドポイントと通信します。モードと URL を設定してから、HTML を読み取ります — または、静的な Build ヘルパーを使用します。
TsgcHTMLComponent_WebAuthnLogin
Bootstrap 5 マークアップ + WebAuthn JS
Delphi, C++ Builder, .NET
静的な Build ヘルパーは、ウィジェットを 1 回の呼び出しでレンダリングします。カスタムのタイトル、ユーザー名セレクター、独自のスクリプトが必要な場合は、完全なコンポーネントを使用します。
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
最もよく使うメンバーです。
Build(aMode, aRegisterURL, aAuthenticateURL) は、モードとエンドポイントに対する妥当な既定値を備え、ウィジェット全体を 1 回の呼び出しでレンダリングします。
Mode は wamRegister、wamAuthenticate、または wamBoth を選択し、表示するボタンを決定します。
RegisterURL と AuthenticateURL は、サーバーのベース URL です(スクリプトが /options と /verify を追加します)。CallbackURL は、サインイン成功後の遷移先です。
RegisterButtonText、AuthenticateButtonText、RegisterButtonStyle、AuthenticateButtonStyle、Title、Description、ShowPasskeyIcon が UI を形作ります。
UsernameSelector は、登録前にフィールドからユーザー名を読み取ります。CustomScript は、組み込みの SimpleWebAuthn JavaScript を完全に置き換えます。
HTML は、SimpleWebAuthnBrowser を使うインライン <script> とともにマークアップを返します。アラートは SuccessAlertStyle / ErrorAlertStyle を使用します。