{"id":19722,"date":"2022-08-26T18:57:25","date_gmt":"2022-08-26T09:57:25","guid":{"rendered":"https:\/\/itport.cloud\/?p=19722"},"modified":"2022-08-26T18:57:25","modified_gmt":"2022-08-26T09:57:25","slug":"post-19722","status":"publish","type":"post","link":"https:\/\/itport.cloud\/?p=19722","title":{"rendered":"\uff08\u7b2c1\u56de\uff09WEB\u30b7\u30b9\u30c6\u30e0\u3092\u30b9\u30de\u30db\u306e\u6307\u7d0b\u8a8d\u8a3c\u3067\u30ed\u30b0\u30a4\u30f3\u3057\u3066\u307f\u308b\uff08Passwordless API\uff09"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\" id=\"e79baee6aca1-1\">\u76ee\u6b21<\/h2>\n\n\n\n<p><a href=\"#title1\">\u6982\u8981<\/a><br><a href=\"#title2\">\u4f7f\u7528\u74b0\u5883<\/a><br><a href=\"#title3\">API\u30ad\u30fc\u306e\u53d6\u5f97<\/a><br><a href=\"#title4\">\u30e9\u30a4\u30d6\u30e9\u30ea\u8ffd\u52a0<\/a><br><a href=\"#title5\">\u5165\u529b\u753b\u9762\u4f5c\u6210<\/a><br><a href=\"#title6\">\u8cc7\u683c\u60c5\u5831\u306e\u767b\u9332<\/a><br>\u3000\u3000<a href=\"#title6-1\">\u2460\u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97<\/a><br>\u3000\u3000<a href=\"#title6-2\">\u2461\u8cc7\u683c\u60c5\u5831\u3092\u767b\u9332<\/a><br><a href=\"#title7\">\u8a8d\u8a3c<\/a><br>\u3000\u3000<a href=\"#title7-1\">\u2460\u30e6\u30fc\u30b6ID\u3092\u57fa\u306b\u767b\u9332\u6e08\u307f\u306e\u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97<\/a><br>\u3000\u3000<a href=\"#title7-2\">\u2461\u30b5\u30a4\u30f3\u30a4\u30f3\u306e\u691c\u8a3c<\/a><br><a href=\"#title8\">\u52d5\u304b\u3057\u3066\u307f\u308b<\/a><br><a href=\"#title9\">\u6700\u5f8c\u306b<\/a><br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"title1\">\u6982\u8981<\/h2>\n\n\n\n<p>Web\u30b7\u30b9\u30c6\u30e0\u3092\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u3067\u4f7f\u7528\u3059\u308b\u969b\u306b\u3001\u6bce\u56de\u30ed\u30b0\u30a4\u30f3ID\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u624b\u5165\u529b\u3059\u308b\u306e\u306f\u5927\u5909\u3067\u3059\u3088\u306d\u3002<br>\u666e\u6bb5\u304b\u3089\u4f7f\u7528\u3057\u3066\u3044\u308b\u6307\u7d0b\u8a8d\u8a3c\u3084\u9854\u8a8d\u8a3c\u3067\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u308c\u3070\u4f7f\u3044\u52dd\u624b\u3082\u826f\u304f\u306a\u308a\u3001\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u9762\u3067\u3082\u5b89\u5fc3\u3067\u3059\u3002<br><br>\u30d6\u30e9\u30a6\u30b6\u6a19\u6e96\u3067\u5bfe\u5fdc\u3057\u3066\u3044\u308bWebAuthn\uff08Web Authentication\uff09\u3068\u3044\u3046\u8a8d\u8a3c\u6280\u8853\u3092\u4f7f\u7528\u3057<br>\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u306e\u6307\u7d0b\u8a8d\u8a3c\u3084\u9854\u8a8d\u8a3c\u3001YubiKey\u306a\u3069\u306e\u5916\u90e8\u30c7\u30d0\u30a4\u30b9\u3067\u306e\u8a8d\u8a3c\u304c\u53ef\u80fd\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br><br>WebAuthn\u3092\u5168\u3066\u7406\u89e3\u3057\u5b9f\u88c5\u3059\u308b\u306e\u306f\u6642\u9593\u304c\u304b\u304b\u308a\u5927\u5909\u3067\u3059\u306e\u3067<br>\u4eca\u56de\u306f\u300cPasswordless.dev\u300d\u3068\u3044\u3046\u30b5\u30fc\u30d3\u30b9\u3092\u5229\u7528\u3057\u3001\u7c21\u5358\u306b\u6307\u7d0b\u8a8d\u8a3c\u3092\u4f7f\u7528\u3057\u305f\u30ed\u30b0\u30a4\u30f3\u306e\u5b9f\u88c5\u3092\u76ee\u6307\u3057\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<br><br>\u7b2c1\u56de\u3067\u306f\u3001\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u306e\u6307\u7d0b\u8a8d\u8a3c\u3092\u4f7f\u7528\u3057\u3001\u8cc7\u683c\u60c5\u5831\u306e\u767b\u9332\u3001\u8a8d\u8a3c\u3092\u884c\u3044\u307e\u3059\u3002<br><br>\u53c2\u8003<br><a href=\"https:\/\/docs.passwordless.dev\/guide\/#what-is-passwordless-dev\" target=\"_blank\" rel=\"noreferrer noopener\">Passwordless guide<\/a><br><a href=\"https:\/\/github.com\/passwordless\/passwordless-dotnet-example\" target=\"_blank\" rel=\"noreferrer noopener\">passwordless-dotnet-example<\/a><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"title2\">\u4f7f\u7528\u74b0\u5883<\/h2>\n\n\n\n<p>\u30d5\u30ec\u30fc\u30e0\u30ef\u30fc\u30af\uff1a.NET 6.0<br>\u7aef\u672b\uff1aAndroid<br>\u30d6\u30e9\u30a6\u30b6\uff1aChrome<br>\u958b\u767a\u74b0\u5883\uff1aVisual Studio2022<br><br>Visual Studio 2022\u3067\u3001\u300cASP.NET Core Web\u30a2\u30d7\u30ea\uff08MVC\uff09\u300d\u306e\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067\u4f5c\u6210\u3057\u305f\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u306b\u7d44\u307f\u8fbc\u307f\u307e\u3059\u3002<br><\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"title3\">API\u30ad\u30fc\u306e\u53d6\u5f97<\/h2>\n\n\n\n<p>\u4e0b\u8a18\u30da\u30fc\u30b8\u306b\u3066API\u30ad\u30fc\u3092\u53d6\u5f97\u3057\u307e\u3059\u3002<br>\u4eca\u56de\u306f\u7121\u511f\u7248\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<br><a href=\"https:\/\/www.passwordless.dev\/\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/ www.passwordless.dev\/ <\/a><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"579\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless01-1-1024x579.png\" alt=\"\" class=\"wp-image-19727\" srcset=\"https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless01-1-1024x579.png 1024w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless01-1-300x170.png 300w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless01-1-768x435.png 768w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless01-1-450x255.png 450w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless01-1-900x509.png 900w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless01-1.png 1230w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>\u300cGet started\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u3001Account name\u3001Admin email\u3092\u5165\u529b\u3002\u300cCreate API key\u300d\u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<br>\u753b\u9762\u306bapikey\uff08\u516c\u958b\u9375\uff09\u3068apisecret\uff08\u79d8\u5bc6\u9375\uff09\u304c\u8868\u793a\u3055\u308c\u307e\u3059\u306e\u3067\u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3057\u3066\u4fdd\u7ba1\u3057\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"779\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless02-1-1024x779.png\" alt=\"\" class=\"wp-image-19728\" srcset=\"https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless02-1-1024x779.png 1024w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless02-1-300x228.png 300w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless02-1-768x584.png 768w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless02-1-421x320.png 421w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless02-1-842x640.png 842w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless02-1.png 1189w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"title4\">\u30e9\u30a4\u30d6\u30e9\u30ea\u8ffd\u52a0<\/h2>\n\n\n\n<p>Passwordless API\u3068\u306e\u3084\u308a\u3068\u308a\u3092\u884c\u3046\u305f\u3081\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u30bf\u30b0\u3092\u8ffd\u52a0\u3057\u307e\u3059\u3002<br>\u4eca\u56de\u306e\u5b9f\u88c5\u3067\u306f\u30c6\u30f3\u30d7\u30ec\u30fc\u30c8\u3067\u751f\u6210\u3055\u308c\u3066\u3044\u308bHome\/Index.cshtml\u5185\u306b\u8a18\u8f09\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\n<script src=\"https:\/\/cdn.passwordless.dev\/dist\/0.2.0\/passwordlessclient.iife.min.js\" crossorigin=\"anonymous\"><\/script>\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"604\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless03-1024x604.png\" alt=\"\" class=\"wp-image-19745\" srcset=\"https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless03-1024x604.png 1024w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless03-300x177.png 300w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless03-768x453.png 768w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless03-450x266.png 450w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless03-900x531.png 900w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless03.png 1457w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"title5\">\u5165\u529b\u753b\u9762\u4f5c\u6210<\/h2>\n\n\n\n<p>\u30e6\u30fc\u30b6ID\u7528\u306e\u30c6\u30ad\u30b9\u30c8\u30dc\u30c3\u30af\u30b9\u3068\u30dc\u30bf\u30f3\u3092\u7528\u610f\u3057\u307e\u3059\u3002<br>\u767b\u9332\u3001\u8a8d\u8a3c\u7528\u306b\uff12\u3064\u7528\u610f\u3057\u3066\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: xml; title: ; notranslate\" title=\"\">\n<div class=\"row\" style=\"margin-bottom:20px\">\n    <h2 id=\"e799bbe98cb2-2\">\u767b\u9332<\/h2>\n    <div class=\"col-md-4\">\n        <div class=\"form-floating\">\n            <input type=\"text\" class=\"form-control\" id=\"register_user\" placeholder=\"\u30e6\u30fc\u30b6ID\" \/>\n            <label for=\"register_user\">\u30e6\u30fc\u30b6ID<\/label>\n        <\/div>\n        <button type=\"button\" id=\"passwordless-register\" class=\"w-100 btn btn-lg btn-primary\" >Register<\/button>\n    <\/div>\n<\/div>\n<div class=\"row\">\n    <h2 id=\"e382b5e382a4e383b3e382a4e383b3-3\">\u30b5\u30a4\u30f3\u30a4\u30f3<\/h2>\n    <div class=\"col-md-4\">\n\n        <div class=\"form-floating\">\n            <input type=\"text\" class=\"form-control\" id=\"signin_user\" placeholder=\"\u30e6\u30fc\u30b6ID\" \/>\n            <label for=\"signin_user\">\u30e6\u30fc\u30b6ID<\/label>\n        <\/div>\n        <button type=\"button\" id=\"passwordless-signin\" class=\"w-100 btn btn-lg btn-primary\" >SignIn<\/button>\n    <\/div>\n<\/div>\n<\/pre><\/div>\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"435\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless04-1024x435.png\" alt=\"\" class=\"wp-image-19749\" srcset=\"https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless04-1024x435.png 1024w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless04-300x127.png 300w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless04-768x326.png 768w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless04-450x191.png 450w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless04-900x382.png 900w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless04.png 1133w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"title6\">\u8cc7\u683c\u60c5\u5831\u306e\u767b\u9332<\/h2>\n\n\n\n<p>\u8cc7\u683c\u60c5\u5831\u306e\u767b\u9332\u3067\u306f\u4ee5\u4e0b\u3092\u884c\u3044\u307e\u3059\u3002<br>\u2460\u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97<br>\u2461\u8cc7\u683c\u60c5\u5831\u3092\u767b\u9332<\/p>\n\n\n\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow\">\n<h4 class=\"wp-block-heading\" id=\"title6-1\">\u2460\u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97<\/h4>\n<\/div><\/div>\n\n\n\n<p>\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u306e\u51e6\u7406\uff08\u4eca\u56de\u306e\u30d7\u30ed\u30b8\u30a7\u30af\u30c8\u3067\u306fController\u90e8\u5206\uff09\u3067\u3001<br>Passwordless API\u306e&#8221;register\/token&#8221;\u3092\u547c\u3073\u51fa\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">POST\nhttps:\/\/apiv2.passwordless.dev\/register\/token\n\u30d8\u30c3\u30c0\nApiSecret: \u79d8\u5bc6\u9375\nContent-Type: application\/json\n\u30d1\u30e9\u30e1\u30fc\u30bf\n{ \"UserId\": \"\", \"username\": \"\", \"displayName\": \"\" } <\/pre>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; highlight: [20]; title: ; notranslate\" title=\"\">\nprivate HttpClient _httpClient;\nprivate readonly static string API_SECRET = \"\uff1c\u53d6\u5f97\u3057\u305f\u79d8\u5bc6\u9375\uff1e\";\n\npublic FIDOController()\n{\n    _httpClient = new HttpClient();\n    _httpClient.BaseAddress = new Uri(\"https:\/\/apiv2.passwordless.dev\/\");\n    _httpClient.DefaultRequestHeaders.Add(\"ApiSecret\", API_SECRET);\n}\n\npublic async Task<ActionResult<string>> GetRegisterToken(string user_id)\n{\n    var json = JsonSerializer.Serialize(new\n    {\n        userId = user_id,\n        username = user_id,\n        DisplayName = \"Mr Guest\"\n    });\n\n    var request = await _httpClient.PostAsync(\"register\/token\", new StringContent(json, Encoding.UTF8, \"application\/json\"));\n    request.EnsureSuccessStatusCode();\n    var token = await request.Content.ReadAsStringAsync();\n\n    return token;\n}\n<\/pre><\/div>\n\n\n<p>\u300cFIDOController.cs\u300d\u3092\u8ffd\u52a0\u3057\u4e0a\u8a18\u3092\u5b9f\u88c5\u3057\u307e\u3059\u3002<br>\u203b\u30b3\u30f3\u30c8\u30ed\u30fc\u30e9\u30fc\u540d\u306f\u4efb\u610f\u3067\u3059<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; title: ; notranslate\" title=\"\">\nprivate HttpClient _httpClient;\nprivate readonly static string API_SECRET = \"\uff1c\u53d6\u5f97\u3057\u305f\u79d8\u5bc6\u9375\uff1e\";\n\npublic FIDOController()\n{\n    _httpClient = new HttpClient();\n    _httpClient.BaseAddress = new Uri(\"https:\/\/apiv2.passwordless.dev\/\");\n    _httpClient.DefaultRequestHeaders.Add(\"ApiSecret\", API_SECRET);\n}\n<\/pre><\/div>\n\n\n<p>\u547c\u3073\u51fa\u3059API\u306e\u30a2\u30c9\u30ec\u30b9BaseAddress\u306b\u300chttps:\/\/apiv2.passwordless.dev\/\u300d\u3092\u8a2d\u5b9a\u3002<br>\u30ea\u30af\u30a8\u30b9\u30c8\u306e\u30d8\u30c3\u30c0\u306b<a href=\"https:\/\/itport.cloud\/wp-admin\/post.php?post=19722&amp;action=edit#title3\">API\u30ad\u30fc\u306e\u53d6\u5f97<\/a>\u3067\u53d6\u5f97\u3057\u305f\u79d8\u5bc6\u9375\u3092\u8a2d\u5b9a\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>\u4e0a\u8a18\u3092\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u5074\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u304b\u3089\u547c\u3073\u51fa\u3057\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; title: ; notranslate\" title=\"\">\n    const API_KEY = \"\uff1c\u53d6\u5f97\u3057\u305f\u516c\u958b\u9375\uff1e\";\n\n    async function RegisterPasswordless(e) {\n        e.preventDefault();\n\n        const userId = $(\"#register_user\").val();\n\n        \/\/\u516c\u958b\u9375\u3067Passwordless client\u3092\u8d77\u52d5\n        const p = new Passwordless.Client({\n          apiKey: API_KEY,\n        });\n\n        \/\/\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u3092\u547c\u3073\u51fa\u3057\u3066\u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97\n        var url = \"@Url.Action(\"GetRegisterToken\",\"FIDO\")\";\n        const myToken = await fetch(url + \"?user_id=\" + userId).then((r) => r.text());\n    }\n<\/pre><\/div>\n\n\n<h4 class=\"wp-block-heading\" id=\"title6-2\">\u2461\u8cc7\u683c\u60c5\u5831\u3092\u767b\u9332<\/h4>\n\n\n\n<p>\u2460\u3067\u53d6\u5f97\u3057\u305f\u30c8\u30fc\u30af\u30f3\u3092\u4f7f\u7528\u3057\u3001\u767b\u9332\u3092\u884c\u3044\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; highlight: [17,18,19,20,21,22,23]; title: ; notranslate\" title=\"\">\n    const API_KEY = \"\uff1c\u53d6\u5f97\u3057\u305f\u516c\u958b\u9375\uff1e\";\n\n    async function RegisterPasswordless(e) {\n        e.preventDefault();\n\n        const userId = $(\"#register_user\").val();\n\n        \/\/\u516c\u958b\u9375\u3067Passwordless client\u3092\u8d77\u52d5\n        const p = new Passwordless.Client({\n          apiKey: API_KEY,\n        });\n\n        \/\/\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u3092\u547c\u3073\u51fa\u3057\u3066\u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97\n        var url = \"@Url.Action(\"GetRegisterToken\",\"FIDO\")\";\n        const myToken = await fetch(url + \"?user_id=\" + userId).then((r) => r.text());\n\n\t\t\/\/\u30c8\u30fc\u30af\u30f3\u3092\u4f7f\u7528\u3057\u767b\u9332\n        try {\n          await p.register(myToken);\n\n        } catch (e) {\n          console.error(\"Things went bad\", e);\n        }\n    }\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"title7\">\u8a8d\u8a3c<\/h2>\n\n\n\n<p> \u8a8d\u8a3c\u3067\u306f\u4ee5\u4e0b\u3092\u884c\u3044\u307e\u3059\u3002<br>\u2460\u30e6\u30fc\u30b6ID\u3092\u57fa\u306b\u767b\u9332\u6e08\u307f\u306e\u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97<br>\u2461\u30b5\u30a4\u30f3\u30a4\u30f3\u306e\u691c\u8a3c<br><\/p>\n\n\n\n<h4 class=\"wp-block-heading\" id=\"title7-1\">\u2460\u30e6\u30fc\u30b6ID\u3092\u57fa\u306b\u767b\u9332\u6e08\u307f\u306e\u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97<\/h4>\n\n\n\n<p>\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u5074\u3067\u30e6\u30fc\u30b6ID\u3092\u57fa\u306b\u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97\u3057\u3001\u30b5\u30a4\u30f3\u30a4\u30f3\u3092\u958b\u59cb\u3057\u307e\u3059\u3002<\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: jscript; highlight: [11,12]; title: ; notranslate\" title=\"\">\n    async function handleSignInSubmit(e) {\n        e.preventDefault();\n        const user_id = $(\"#signin_user\").val();\n\n        \/\/\u516c\u958bAPI\u30ad\u30fc\u3067Passwordless client\u3092\u8d77\u52d5\n        const p = new Passwordless.Client({\n          apiKey: API_KEY,\n        });\n\n        try {\n            \/\/\u30d1\u30b9\u30ef\u30fc\u30c9\u30ec\u30b9API\u3068\u30d6\u30e9\u30a6\u30b6\u304c\u30e6\u30fc\u30b6ID\u306b\u57fa\u3065\u304d\u30b5\u30a4\u30f3\u30a4\u30f3\u3092\u958b\u59cb\u3057\u307e\u3059\n            const token = await p.signinWithId(user_id);\n        } catch (e) {\n            console.error(\"Things went really bad: \", e);\n        }\n    }\n<\/pre><\/div>\n\n\n<h4 class=\"wp-block-heading\" id=\"title7-2\">\u2461\u30b5\u30a4\u30f3\u30a4\u30f3\u306e\u691c\u8a3c<\/h4>\n\n\n\n<p>\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u306e\u51e6\u7406\u3067\u3001Passwordless API\u306e\u201dsignin\/verify\u201d\u3092\u547c\u3073\u51fa\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">POST\nhttps:\/\/apiv2.passwordless.dev\/signin\/verify\n\u30d8\u30c3\u30c0\nApiSecret: \u79d8\u5bc6\u9375\nContent-Type: application\/json\n\u30d1\u30e9\u30e1\u30fc\u30bf\n{ \"token\": \"yUf6_wWdDh02ItIvnCKT_02ItIvn\u2026\" }<\/pre>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: csharp; highlight: [9,10]; title: ; notranslate\" title=\"\">\npublic async Task<IActionResult> VerifySignInToken(string token)\n{\n    \/\/ fido2\u8a8d\u8a3c\u304c\u6709\u52b9\u304b\u3069\u3046\u304b\u3001\u3069\u306e\u30e6\u30fc\u30b6\u30fc\u306b\u5bfe\u3057\u3066\u6709\u52b9\u304b\u3092\u78ba\u8a8d\n    var json = JsonSerializer.Serialize(new\n    {\n        token\n    });\n\n    var request = await _httpClient.PostAsync(\"signin\/verify\", new StringContent(json, Encoding.UTF8, \"application\/json\"));\n    request.EnsureSuccessStatusCode();\n    var response = await request.Content.ReadAsStringAsync();\n    var signin = JsonSerializer.Deserialize<SignInDto>(response, new JsonSerializerOptions { PropertyNameCaseInsensitive = true });\n\n    return Json(signin);\n}\n\npublic class SignInDto\n{\n    public bool Success { get; set; }\n\n    public string UserId { get; set; }\n    public DateTime Timestamp { get; set; }\n    public string RPID { get; set; }\n    public string Origin { get; set; }\n    public string Device { get; set; }\n    public string Country { get; set; }\n    public string Nickname { get; set; }\n    public DateTime ExpiresAt { get; set; }\n}\n<\/pre><\/div>\n\n\n<p><\/p>\n\n\n\n<p> \u4e0a\u8a18\u3092\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u5074\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u304b\u3089\u547c\u3073\u51fa\u3057\u307e\u3059\u3002 <\/p>\n\n\n<div class=\"wp-block-syntaxhighlighter-code \"><pre class=\"brush: plain; highlight: [14,15,16,17,18]; title: ; notranslate\" title=\"\">\n    async function handleSignInSubmit(e) {\n        e.preventDefault();\n        const user_id = $(\"#signin_user\").val();\n\n        \/\/\u516c\u958bAPI\u30ad\u30fc\u3067Passwordless client\u3092\u8d77\u52d5\n        const p = new Passwordless.Client({\n          apiKey: API_KEY,\n        });\n\n        try {\n            \/\/\u30d1\u30b9\u30ef\u30fc\u30c9\u30ec\u30b9API\u3068\u30d6\u30e9\u30a6\u30b6\u304c\u30a8\u30a4\u30ea\u30a2\u30b9\u306b\u57fa\u3065\u304d\u30b5\u30a4\u30f3\u30a4\u30f3\u3092\u958b\u59cb\u3057\u307e\u3059\n            const token = await p.signinWithId(user_id);\n\n            \/\/\u30d0\u30c3\u30af\u30a8\u30f3\u30c9\u3092\u547c\u3073\u51fa\u3057\u3066\u3001\u30b5\u30a4\u30f3\u30a4\u30f3\u304b\u3089\u4f5c\u6210\u3055\u308c\u305f\u30c8\u30fc\u30af\u30f3\u3092\u691c\u8a3c\n            var url = \"@Url.Action(\"VerifySignInToken\",\"FIDO\")\";\n            const user = await fetch(url + \"?token=\" + token).then((r) =>\n                r.json()\n            );\n        } catch (e) {\n            console.error(\"Things went really bad: \", e);\n        }\n    }\n<\/pre><\/div>\n\n\n<h2 class=\"wp-block-heading\" id=\"title8\">\u52d5\u304b\u3057\u3066\u307f\u308b<\/h2>\n\n\n\n<p>\u4ee5\u4e0a\u3067\u5b9f\u88c5\u304c\u5b8c\u4e86\u3057\u305f\u306e\u3067\u767a\u884c\u3057\u3066\u30b5\u30fc\u30d0\u30fc\u306b\u914d\u7f6e\u3057\u307e\u3059\u3002<br><span style=\"color:#000000\" class=\"tadv-color\">\u5b9f\u884c\u6642\u306e\u6ce8\u610f\u70b9\u3068\u3057\u3066\u3001WebAuthn\u306f<span style=\"background-color:#ff6900\" class=\"tadv-background-color\">localhost<\/span>\u307e\u305f\u306f<span style=\"background-color:#ff6900\" class=\"tadv-background-color\">https<\/span>\u3067\u306a\u3044\u3068\u6b63\u3057\u304f\u8a8d\u8a3c\u3067\u304d\u307e\u305b\u3093<\/span>\u3002<br><br>\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u3067\u4f5c\u6210\u3057\u305f\u30da\u30fc\u30b8\u306b\u30a2\u30af\u30bb\u30b9\u3057\u3066\u307f\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"438\" height=\"1024\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless05-438x1024.png\" alt=\"\" class=\"wp-image-19769\" srcset=\"https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless05-438x1024.png 438w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless05-128x300.png 128w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless05-768x1794.png 768w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless05-877x2048.png 877w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless05-137x320.png 137w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless05-274x640.png 274w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless05.png 1644w\" sizes=\"auto, (max-width: 438px) 100vw, 438px\" \/><\/figure>\n\n\n\n<p>\u7121\u4e8b\u8868\u793a\u3055\u308c\u307e\u3057\u305f\u3002<br>\u72b6\u6cc1\u304c\u5206\u304b\u308b\u3088\u3046\u306b\u3001\u53f3\u5074\u306b\u30ed\u30b0\u3092\u8868\u793a\u3059\u308b\u3088\u3046\u306b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u6b21\u306f\u767b\u9332\u3057\u3066\u307f\u307e\u3059\u3002<br>\u767b\u9332\u306e\u30e6\u30fc\u30b6ID\u306b\u300cuser01\u300d\u3092\u5165\u529b\u3057\u3001\u300cRegister\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"576\" height=\"1024\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless06-576x1024.jpg\" alt=\"\" class=\"wp-image-19772\" srcset=\"https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless06-576x1024.jpg 576w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless06-169x300.jpg 169w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless06-768x1365.jpg 768w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless06-864x1536.jpg 864w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless06-1152x2048.jpg 1152w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless06-180x320.jpg 180w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless06-360x640.jpg 360w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless06-scaled.jpg 1440w\" sizes=\"auto, (max-width: 576px) 100vw, 576px\" \/><\/figure>\n\n\n\n<p>\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u306e\u6307\u7d0b\u8a8d\u8a3c\u304c\u8868\u793a\u3055\u308c\u307e\u3057\u305f\uff01<br>\uff08\u6307\u7d0b\u8a8d\u8a3c\u306e\u753b\u9762\u306f\u30b9\u30af\u30ea\u30fc\u30f3\u30b7\u30e7\u30c3\u30c8\u304c\u53d6\u308c\u306a\u3044\u306e\u3067\u30ab\u30e1\u30e9\u3067\u64ae\u5f71\uff09<br><br>\u8a8d\u8a3c\u3057\u3066\u307f\u308b\u3068\u3002\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"438\" height=\"1024\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless07-438x1024.png\" alt=\"\" class=\"wp-image-19773\" srcset=\"https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless07-438x1024.png 438w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless07-128x300.png 128w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless07-768x1794.png 768w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless07-877x2048.png 877w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless07-137x320.png 137w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless07-274x640.png 274w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless07.png 1644w\" sizes=\"auto, (max-width: 438px) 100vw, 438px\" \/><\/figure>\n\n\n\n<p>\u5c0f\u3055\u3044\u3067\u3059\u304c\u300cSuccessfully registered\u300d\u304c\u8868\u793a\u3055\u308c\u3001\u767b\u9332\u6210\u529f\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u767b\u9332\u3057\u305f\u30e6\u30fc\u30b6\u3067\u30b5\u30a4\u30f3\u30a4\u30f3\u3057\u3066\u307f\u307e\u3059\u3002<br>\u30b5\u30a4\u30f3\u30a4\u30f3\u306e\u30e6\u30fc\u30b6ID\u306b\u300cuser01\u300d\u3092\u5165\u529b\u3057\u300cSignIn\u300d\u30dc\u30bf\u30f3\u3092\u30af\u30ea\u30c3\u30af<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"576\" height=\"1024\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless09-576x1024.jpg\" alt=\"\" class=\"wp-image-19774\" srcset=\"https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless09-576x1024.jpg 576w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless09-169x300.jpg 169w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless09-768x1365.jpg 768w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless09-864x1536.jpg 864w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless09-1152x2048.jpg 1152w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless09-180x320.jpg 180w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless09-360x640.jpg 360w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless09-scaled.jpg 1440w\" sizes=\"auto, (max-width: 576px) 100vw, 576px\" \/><\/figure>\n\n\n\n<p>\u767b\u9332\u6642\u3068\u540c\u3058\u3088\u3046\u306b\u6307\u7d0b\u8a8d\u8a3c\u304c\u8868\u793a\u3055\u308c\u308b\u306e\u3067\u8a8d\u8a3c\u3002<br><br><\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"438\" height=\"1024\" src=\"https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless10-438x1024.png\" alt=\"\" class=\"wp-image-19775\" srcset=\"https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless10-438x1024.png 438w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless10-128x300.png 128w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless10-768x1794.png 768w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless10-877x2048.png 877w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless10-137x320.png 137w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless10-274x640.png 274w, https:\/\/itport.cloud\/wp-content\/uploads\/2022\/08\/passwordless10.png 1644w\" sizes=\"auto, (max-width: 438px) 100vw, 438px\" \/><\/figure>\n\n\n\n<p>\u8a8d\u8a3c\u6210\u529f\u3067\u3059\uff01<br>\u30ed\u30b0\u306eUser details\u306b\u60c5\u5831\u304c\u8868\u793a\u3055\u308c\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"title9\">\u6700\u5f8c\u306b<\/h2>\n\n\n\n<p>\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u7528\u3057\u305f\u305f\u3081\u7d30\u304b\u3044\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u304c\u3067\u304d\u307e\u305b\u3093\u304c\u3001\u7c21\u5358\u306b\u5b9f\u88c5\u304c\u53ef\u80fd\u3067\u3059\u3002<br><br>\u4eca\u56de\u306fWebAuthn\u3067\u306e\u767b\u9332\u3001\u8a8d\u8a3c\u306e\u307f\u306a\u306e\u3067\u3001\u3053\u308c\u3060\u3051\u3067\u306fWEB\u30b7\u30b9\u30c6\u30e0\u306b\u30ed\u30b0\u30a4\u30f3\u304c\u3067\u304d\u307e\u305b\u3093\u3002<br>\u6b21\u56de\u306f\u3001ID\u3001PW\u3067\u767b\u9332\u3057\u305f\u30e6\u30fc\u30b6\u304c\u5b58\u5728\u3059\u308bWEB\u30b7\u30b9\u30c6\u30e0\u306b\u4eca\u56de\u306e\u5185\u5bb9\u3092\u7d44\u307f\u8fbc\u307f\u3001<br>\u65e2\u5b58\u30e6\u30fc\u30b6\u3068\u306e\u7d10\u3065\u3051\u3001WEB\u30b7\u30b9\u30c6\u30e0\u3078\u306e\u30ed\u30b0\u30a4\u30f3\u3092\u5b9f\u88c5\u3057\u3066\u307f\u305f\u3044\u3068\u601d\u3044\u307e\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u76ee\u6b21 \u6982\u8981\u4f7f\u7528\u74b0\u5883API\u30ad\u30fc\u306e\u53d6\u5f97\u30e9\u30a4\u30d6\u30e9\u30ea\u8ffd\u52a0\u5165\u529b\u753b\u9762\u4f5c\u6210\u8cc7\u683c\u60c5\u5831\u306e\u767b\u9332\u3000\u3000\u2460\u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97\u3000\u3000\u2461\u8cc7\u683c\u60c5\u5831\u3092\u767b\u9332\u8a8d\u8a3c\u3000\u3000\u2460\u30e6\u30fc\u30b6ID\u3092\u57fa\u306b\u767b\u9332\u6e08\u307f\u306e\u30c8\u30fc\u30af\u30f3\u3092\u53d6\u5f97\u3000\u3000\u2461\u30b5\u30a4\u30f3\u30a4\u30f3\u306e\u691c\u8a3c\u52d5\u304b\u3057\u3066\u307f\u308b\u6700\u5f8c\u306b \u6982\u8981 Web\u30b7\u30b9\u30c6\u30e0\u3092\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u3067\u4f7f\u7528\u3059\u308b\u969b\u306b\u3001\u6bce\u56de\u30ed\u30b0\u30a4\u30f3ID\u3001\u30d1\u30b9\u30ef\u30fc\u30c9\u3092\u624b\u5165\u529b\u3059\u308b\u306e\u306f\u5927\u5909\u3067\u3059\u3088\u306d\u3002\u666e\u6bb5\u304b\u3089\u4f7f\u7528\u3057\u3066\u3044\u308b\u6307\u7d0b\u8a8d\u8a3c\u3084\u9854\u8a8d\u8a3c\u3067\u30ed\u30b0\u30a4\u30f3\u3067\u304d\u308c\u3070\u4f7f\u3044\u52dd\u624b\u3082\u826f\u304f\u306a\u308a\u3001\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u9762\u3067\u3082\u5b89\u5fc3\u3067\u3059\u3002\u30d6\u30e9\u30a6\u30b6\u6a19\u6e96\u3067\u5bfe\u5fdc\u3057\u3066\u3044\u308bWebAuthn\uff08Web Authentication\uff09\u3068\u3044\u3046\u8a8d\u8a3c\u6280\u8853\u3092\u4f7f\u7528\u3057\u30b9\u30de\u30fc\u30c8\u30d5\u30a9\u30f3\u306e\u6307\u7d0b\u8a8d\u8a3c\u3084\u9854\u8a8d\u8a3c\u3001YubiKey\u306a\u3069\u306e\u5916\u90e8\u30c7\u30d0\u30a4\u30b9\u3067\u306e\u8a8d\u8a3c\u304c\u53ef\u80fd\u3068\u306a\u3063\u3066\u3044\u307e\u3059\u3002WebAuthn\u3092\u5168\u3066&hellip;","protected":false},"author":10,"featured_media":17821,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[149],"tags":[150],"class_list":{"0":"post-19722","1":"post","2":"type-post","3":"status-publish","4":"format-standard","5":"has-post-thumbnail","7":"category-passwordless","8":"tag-season50"},"_links":{"self":[{"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/posts\/19722","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/itport.cloud\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=19722"}],"version-history":[{"count":48,"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/posts\/19722\/revisions"}],"predecessor-version":[{"id":19798,"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/posts\/19722\/revisions\/19798"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itport.cloud\/index.php?rest_route=\/wp\/v2\/media\/17821"}],"wp:attachment":[{"href":"https:\/\/itport.cloud\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=19722"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itport.cloud\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=19722"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itport.cloud\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=19722"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}