WebAuthn | 登録

WebAuthn 登録にはクライアント(ブラウザ)、認証器(セキュリティデバイス)、およびリライングパーティ(RP; TsgcWSAPIServer_WebAuthn Delphi/CBuilderサーバー)が関与します。

 

登録オプション

 

新しいユーザー資格情報の作成には通常、クライアントが TsgcWSAPIServer_WebAuthn サーバーで設定された登録オプションエンドポイントへの新しい HTTP リクエストを使用して登録フローを開始する必要があります。デフォルトのエンドポイントは /sgcWebAuthn/Registration/Options です。サーバーがドメイン https://www.test.com でリスニングしている場合、クライアントは URL https://www.test.com/sgcWebAuthn/Registration/Options に新しいリクエストを行う必要があります。

 

クライアントは、以下の JSON をペイロードとして(ユーザー名として test を使用して)新しいリクエストを送信します。

 

{"username":"test","algorithms":[]}

 

サーバーは要求を読み取り、新しいチャレンジを含む応答を返します。

 

{
"rp": {
"name": "localhost",
"id": "localhost"
},
"user": {
"id": "36b9d6a84204487382fee62e7e67a80d",
"name": "test",
"displayName": "test"
},
"challenge": "6c6c468c99f24bf29a85a15b661f75f385654f97309c46bab2909c926e17ccbe",
"pubKeyCredParams": [
{
"type": "public-key",
"alg": "-7"
},
{
"type": "public-key",
"alg": "-257"
}
],
"timeout": 60000,
"excludeCredentials": [],
"authenticatorSelection": {
"residentKey": "preferred",
"requireResidentKey": false,
"userVerification": "preferred"
},
"attestation": "direct",
"hints": [],
"extensions": {
"credProps": true
}
}

 

応答は以下のデータを返します。

 

 

 

登録の確認

 

クライアントがサーバーからレスポンスを受け取ると、レスポンスを読み取り、オーセンティケーターはクライアントのウェブブラウザーに暗号化データを返します。クライアントは次に TsgcWSAPIServer_WebAuthn サーバーで設定された登録検証エンドポイント(デフォルトは /sgcWebAuthn/Registration/Verify)に以下のデータを含む新しい HTTP リクエストを送信します。

そのため、サーバーがドメイン https://www.test.com でリスニングしている場合、クライアントは URL https://www.test.com/sgcWebAuthn/Registration/Verify に新しいリクエストを行う必要があります。

 

認証者はブラウザの JavaScript に以下で応答します:

 

 

以下に使用例を示します。

 

{
"id": "yeA4BVRlrAfLG-KzqsL_rlI4ffhuKHK8uoEkVoab065UkS82Zqlh9VFQHIYwOuOo",
"rawId": "yeA4BVRlrAfLG-KzqsL_rlI4ffhuKHK8uoEkVoab065UkS82Zqlh9VFQHIYwOuOo",
"response": {
"attestationObject": "o2NmbXRmcGFja2VkZ2F0dFN0....",
"clientDataJSON": "eyJ0eXBlIjoid2ViYXV0aG4uY3Jl....",
"transports": [
"nfc",
"usb"
],
"publicKeyAlgorithm": -7,
"publicKey": "MFkwEwYHKoZIzj0CAQYIKoZIzj....",
"authenticatorData": "SZYN5YgOjGh0NBcPZHZgW4_k...."
},
"type": "public-key",
"clientExtensionResults": {
"credProps": {
"rk": true
}
},
"authenticatorAttachment": "cross-platform"
}

 

サーバーはクライアントからのJSONリクエストを読み取り、公開鍵と資格情報IDをデコード、検証、保存します。

 

attestationObject と clientDataJSON をデコードします:

 

 

資格情報の保存:

 

 

 

 

登録フロー

以下のリンクを使用して登録フロープロセスの詳細を確認します: