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 헬퍼는 단일 호출로 위젯을 렌더링합니다. 사용자 지정 제목, 사용자 이름 선택기 또는 자체 스크립트가 필요할 때는 전체 컴포넌트를 사용하십시오.
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)는 모드와 엔드포인트에 대한 합리적인 기본값으로 한 번의 호출에 위젯 전체를 렌더링합니다.
Mode는 wamRegister, wamAuthenticate 또는 wamBoth를 선택하여 어떤 버튼이 나타날지 결정합니다.
RegisterURL과 AuthenticateURL은 서버의 베이스입니다(스크립트가 /options와 /verify를 추가합니다). CallbackURL은 성공적인 로그인이 도달하는 곳입니다.
RegisterButtonText, AuthenticateButtonText, RegisterButtonStyle, AuthenticateButtonStyle, Title, Description 및 ShowPasskeyIcon이 UI를 구성합니다.
UsernameSelector는 등록 전에 필드에서 사용자 이름을 읽습니다. CustomScript는 내장 SimpleWebAuthn JavaScript를 완전히 대체합니다.
HTML은 SimpleWebAuthnBrowser를 사용하는 인라인 <script>와 함께 마크업을 반환합니다. 알림은 SuccessAlertStyle / ErrorAlertStyle을 사용합니다.