「[[マイクロソフト系技術情報 Wiki>http://techinfoofmicrosofttech.osscons.jp/]]」は、「[[Open棟梁Project>https://github.com/OpenTouryoProject/]]」,「[[OSSコンソーシアム .NET開発基盤部会>https://www.osscons.jp/dotNetDevelopmentInfrastructure/]]」によって運営されています。

-戻る
--[[FIDO2]]
--[[Microsoft Passport]]

* 目次 [#t997f2c6]
#contents

*概要 [#oe736650]
[[FIDO]] の Web Application用 JavaScript Library。
Web Authentication API は
-[[FIDO2]] の Web Application用 JavaScript Library。
-公開鍵暗号を用た認証を行う [[Credential Management API>#r3e74bd1]] の拡張機能
-パスワードを用いない認証に加え、SMS を用いない二要素認証を実現する。

*API [#obe238ba]

-昔のサンプルは、[[ドラフト実装(makeCredential & getAssertion)>#e44e4639]]だったが、~
最近のサンプルは、[[Credential Management API(navigator.credentials.create & get)>#m60489ae]]に、変わっている。
最近のサンプルは、[[Credential Management API>#r3e74bd1]][[(navigator.credentials.create & get)>#m60489ae]]に、変わっている。

-以下のような状況(?)らしい。
>「[[Progressive Web App Checklist>https://developers.google.com/web/progressive-web-apps/checklist]] には記載されていないですが、~
[[Web Authentication API>https://w3c.github.io/webauthn/]] の仕様では PWA の API の 1 つである~
[[Credential Management API>https://w3c.github.io/webappsec-credential-management/]] との連携について言及されています。」
[[Credential Management API>#r3e74bd1]] との連携について言及されています。」

**ドラフト実装(makeCredential & getAssertion) [#e44e4639]
-使用する (主な) 関数は 2 つ。

-W3C で定義されている API の名前は
--makeCredential()メソッド
--getAssertion()メソッド

***仕様 [#c9b811f4]
-ドラフト
--現在はドラフト仕様に基づく ms-prefix実装であるため、~
現在 (2016/05 時点) の Edge の実装では、明示的に下記を使用。
---window.msCredentials.makeCredential
---window.msCredentials.getAssertion

-[[Polyfill>https://dotnetdevelopmentinfrastructure.osscons.jp/index.php?JavaScript#me2ddef5]]~
[[webauthn.js>#x7fbdb40]]という[[Polyfill>https://dotnetdevelopmentinfrastructure.osscons.jp/index.php?JavaScript#me2ddef5]]を使用すると良い。

-Promise~
[[Promise>https://dotnetdevelopmentinfrastructure.osscons.jp/index.php?JavaScript#j2209b5b]]で実装されている。

***メソッド [#z9b20aaa]
-makeCredential()メソッド~
初回の key pair の作成
--private key の (Device への) 登録
--public key の取得 ([[JWK>JWT]] format)

-getAssertion()メソッド~
private key を用いた challenge data のデジタル署名

***補足 [#x49db2e9]
-(現時点で)以下に値が入ってこない。
--result.algorithm
--result.attestation

-PKIのキーペアは、CredentialIDを使用して、紐付けを行う模様。

--このキーペアは、[[AIK(認証IDキー)>TPM(Trusted Platform Module)#e8431d17]]だと思われる。

--従って、CredentialIDには、認証器が生成した値を使用する必要がある。

--なので、実装に注意が必要(あるサンプルコードは失敗する)。~
https://github.com/OpenTouryoProject/MultiPurposeAuthSite/issues/50#issuecomment-336858649

--なお、CredentialIDを使用すれば、複数のデバイスの登録が可能。~
しかし、デバイスを特定する方法が無いので、登録が重複してしまう。

**Credential Management API(navigator.credentials.create & get) [#m60489ae]
-使用する (主な) 関数は 2 つ。

-W3C で定義されている API の名前は
**navigator.credentials.create() & get()メソッド [#m60489ae]
-W3C で定義されている使用する (主な) API の名前は、
--navigator.credentials.create()メソッド
--navigator.credentials.get()メソッド

***仕様 [#ec444782]
-セキュアコンテキスト (https or localhost)であることを必要とし、~
ブラウザがセキュアコンテキストで動作していない場合は利用できない。

***メソッド [#l8a25548]
***navigator.credentials.create()メソッド [#n2d59363]
-[[登録(Attestation)>FIDO2#e7f048cc]]

-publicKeyオプションと併用する。
--PublicKeyCredentialCreationOptions: 登録リクエスト作成のオプションを記述する。
--PublicKeyCredential: 作成された登録リクエストを格納する。

***navigator.credentials.get()メソッド [#vaec9d63]
-[[認証(Assertion)>FIDO2#dacdf419]]

-publicKeyオプションと併用する。
--

*[[仕様を読む>#wfcfd0f0]] [#gbc53e73]

**用語 [#o046d504]

**依存 [#s8d69a88]

**[[登録(Attestation)>FIDO2#e7f048cc]]: navigator.credentials.create()メソッド [#d6d0bcf7]

***引数:PublicKeyCredentialCreationOptions [#k26de1bf]

-主要な引数
--Challenge
---ランダムな情報の大きなバッファー(例えば100バイト以上)が絶対に重要。
---登録過程のセキュリティを確保するためにサーバ上で生成する必要がある。

-色々なオプションが指定できる。

--Attestation Conveyance Preference enumeration~
基本的に、登録(Attestation)プロセスは、クライアントによって使用される認証器が、~
FIDO2 Server([[RP Server>FIDO#ra24f089]])で信頼可能か検証するための多くのステップを費やす。

---"none"(既定値)~
ユーザー名/パスワードをFIDO2に切り替える場合。~
(FIDO2はパスワードよりも優れていると考える場合)

---"indirect"~
スマートカードまたはUAFから移行する場合、~
認証器の信頼性をattestation statement から確認する必要がある。~
クライアントがattestation statement を取得する方法を決定できる。

---"direct"~
スマートカードまたはUAFから移行する場合、~
認証器の信頼性をattestation statement から確認する必要がある。~
サーバーがattestation statement を必要とすることを示す。

***戻り値:PublicKeyCredential [#z3e54d7d]
厳密には、AuthenticatorAttestationResponse を含む PublicKeyCredential に解決する Promiseを返す。

-id(rawId) : GlobalにUniqueなPublicKeyCredentialのID
-type : public-key(このUseCaseでは固定)

-AuthenticatorAttestationResponseのプロパティ

--clientDataJSON~
認証器のauthenticatorMakeCredential()メソッドの戻り値
---type
---challenge
---origin
---tokenBindingId
---clientExtensions
---authenticatorExtensions

--attestationObject~
id(rawId)に対応した、公開鍵と他の認証データ

---authenticatorData

---fmt:アテステーションステートメントの形式を示すテキスト文字列~
("packed"、 "tpm"、 "android-key"、 "android-safetynet"、 "fido-u2f"、"none")

---attStmt:"fmt"で定義された形式のアテステーションステートメント


**[[認証(Assertion)>FIDO2#dacdf419]]: navigator.credentials.get()メソッド [#d385464d]

*参考 [#b22f8c0c]
-fido2-net-lib https://github.com/abergs/fido2-net-lib を分析している。~
https://gist.github.com/daisukenishino2/d50bfcfa415902abfdee0e27ed48a715

**w3c [#wfcfd0f0]
-Web Authentication Working Group~
https://www.w3.org/Webauthn/

--Credential Management Level 1~
https://www.w3.org/TR/credential-management-1/

--Web Authentication: An API for accessing Public Key Credentials - Level 1~
http://w3c.github.io/webauthn/
--Web Authentication: An API for accessing Public Key Credentials Level 1~
https://www.w3.org/TR/webauthn/

**webauthn.org [#ec6dcea6]
-WebAuthn demo~
https://webauthn.org
--apowers313/fido2-server-demo: A set of FIDO2 / WebAuthn demo servers~
https://github.com/apowers313/fido2-server-demo/

***fido2-net-lib [#re8fa185]
-abergs/fido2-net-lib: A proof of Concept implementation library~
https://github.com/abergs/fido2-net-lib

--+ demo for fido2 and WebAuthn using .NET (Work in progress)~
https://github.com/abergs/fido2-net-lib/tree/master/Fido2Demo

-WebAuthn.io~
https://fido2.azurewebsites.net/

-FIDO2 - Things I learned by building a FIDO2 server – Ideas Of Anders Åberg~
http://ideasof.andersaberg.com/development/fido2-net-library

**MDN - Web APIs [#qcf1790f]

***Credential Management API [#r3e74bd1]
-Credential Management API~
https://developer.mozilla.org/ja/docs/Web/API/Credential_Management_API

-Credential~
https://developer.mozilla.org/ja/docs/Web/API/Credential
--PublicKeyCredential~
https://developer.mozilla.org/ja/docs/Web/API/PublicKeyCredential
--PasswordCredential~
https://developer.mozilla.org/ja/docs/Web/API/PasswordCredential
--FederatedCredential~
https://developer.mozilla.org/ja/docs/Web/API/FederatedCredential

***Web Authentication API [#wbffefc4]
[[Credential Management API>#r3e74bd1]]中のPublicKeyCredentialを拡張したもの。

-Web Authentication API~
https://developer.mozilla.org/ja/docs/Web/API/Web_Authentication_API

-PublicKeyCredential~
https://developer.mozilla.org/ja/docs/Web/API/PublicKeyCredential
--PublicKeyCredentialCreationOptions~
https://developer.mozilla.org/ja/docs/Web/API/PublicKeyCredentialCreationOptions
--AuthenticatorAttestationResponse~
https://developer.mozilla.org/ja/docs/Web/API/AuthenticatorAttestationResponse
---clientDataJSON~
https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorResponse/clientDataJSON
---attestationObject~
https://developer.mozilla.org/en-US/docs/Web/API/AuthenticatorAttestationResponse/attestationObject

**Yubico [#m94f60dc]
-Yubico WebAuthn demo~
https://demo.yubico.com/webauthn/

-Developer Program~
https://www.yubico.com/why-yubico/for-developers/developer-program/

-New NIST Authentication Guidelines for Public Safety and First Responders~
https://www.yubico.com/2018/05/new-nist-authentication-guidelines-for-public-safety-and-first-responders/

***blog.jxck.io [#u5a7037b]
-Web Authentication API で FIDO U2F(YubiKey) 認証 | ~
https://blog.jxck.io/entries/2018-05-15/webauthentication-api.html
--Web Authentication API (FIDO-U2F) DEMO~
https://labs.jxck.io/webauthentication/fido-u2f/

***enjoy struggling [#ne242fa6]
-Edge が WebAuthN をサポートしたらしいので色々試してみた(Insider Preview)~
https://blog.haniyama.com/2018/06/17/edge-support-webauthn/
--HWataru/webauthn-demo: WebAuthn Demo~
https://github.com/HWataru/webauthn-demo
--fido-alliance/webauthn-demo: WebAuthn Demo~
https://github.com/fido-alliance/webauthn-demo

***(株)ソフト技研 [#hdc805ce]
-ワンタイムパスワードトークンYubiKey~
http://yubikey.yubion.com
--ブログ~
http://yubikey.yubion.com/blog.html

**Qiita [#rff64274]
-もうすぐ来る? Web Authentication APIについて調べてみた~
https://qiita.com/syoichi/items/62e6aa66938692a3c0b6

*参考(旧)[#rdddcc10]
[[ドラフト実装(makeCredential & getAssertion)>#e44e4639]]の頃の参考情報。

**しばやん雑記 [#t7f57b1c]
-Windows Hello を Web で使うための Web Authentication API (FIDO 2.0) について調べた ~
http://blog.shibayan.jp/entry/20170129/1485665985

-ASP.NET Core Identity に Windows Hello を使ったログイン機能を追加する~
http://blog.shibayan.jp/entry/20170131/1485844075
--shibayan/webauthn-aspnet-demo: Demo Application for Windows Hello (Web Authn API)~
https://github.com/shibayan/webauthn-aspnet-demo

***Views [#vf27ef62]
-Manage/AddPublicKey.cshtml~
https://github.com/shibayan/webauthn-aspnet-demo/blob/master/src/WebAuthnDemo/Views/Manage/AddPublicKey.cshtml

-Account/Login.cshtml~
https://github.com/shibayan/webauthn-aspnet-demo/blob/master/src/WebAuthnDemo/Views/Account/Login.cshtml

***Controllers [#ddeef527]
-AccountController.cs~
https://github.com/shibayan/webauthn-aspnet-demo/blob/master/src/WebAuthnDemo/Controllers/AccountController.cs#L149

-ManageController.cs~
https://github.com/shibayan/webauthn-aspnet-demo/blob/master/src/WebAuthnDemo/Controllers/ManageController.cs#L127

***Services [#jd6b7233]
-FidoAuthenticator.cs~
https://github.com/shibayan/webauthn-aspnet-demo/blob/master/src/WebAuthnDemo/Services/FidoAuthenticator.cs

**microsoft.com [#z2da3470]
-Web Authentication API 紹介 (Windows Hello を使った Edge 開発) – Tsmatz~
https://blogs.msdn.microsoft.com/tsmatsuz/2016/06/08/w3c-web-authentication-api-javascript/

-Dev guide: Web authentication - Microsoft Edge Development~
https://developer.microsoft.com/en-us/microsoft-edge/platform/documentation/dev-guide/device/web-authentication/

-A world without passwords: Windows Hello in Microsoft Edge - Microsoft Edge Dev BlogMicrosoft Edge Dev Blog~
https://blogs.windows.com/msedgedev/2016/04/12/a-world-without-passwords-windows-hello-in-microsoft-edge/

***API リファレンス [#x65290df]
-Web Authentication~
https://msdn.microsoft.com/en-us/library/mt697638.aspx
--MSCredentials object~
https://msdn.microsoft.com/en-us/library/mt697639.aspx
---makeCredential method~
https://msdn.microsoft.com/en-us/library/mt697641.aspx
---getAssertion method~
https://msdn.microsoft.com/en-us/library/mt697640.aspx

***adrianba/fido-snippets [#x7fbdb40]
-polyfill
--webauthn.js~
https://github.com/adrianba/fido-snippets/blob/master/polyfill/webauthn.js
--polyfill.html~
https://github.com/adrianba/fido-snippets/blob/master/polyfill/polyfill.html
-csharp/app.cs~
https://github.com/adrianba/fido-snippets/blob/master/csharp/app.cs

**Qiita [#y5466d73]
-まだパスワードで消耗してるの? TouchIDとFIDO2.0でパスワードレス認証を実装してみた(Keycloak編)~
https://qiita.com/rkato/items/3607e6870c71fbd3ec06

*[[FIDO2.0対応 - Open 棟梁 Wiki>https://opentouryo.osscons.jp/index.php?FIDO2.0%E5%AF%BE%E5%BF%9C]] [#r622885f]

----
Tags: [[:認証基盤]]


トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS