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

-[[戻る>WebAuthnを実装する。]]

* 目次 [#t997f2c6]
#contents

*概要 [#qe0960bd]
-[[.NET Standard]] 対応の [[Web Authentication API]]対応ライブラリ。
-
-previewも取れ、公式バージョンもリリースされたもよう。
--https://twitter.com/andersaberg/status/1156679907721797633~
After 1,5 years of development, Fido2 for .net is now OFFICIALLY released!

*詳細 [#g22d73af]
現在、分析中。
-2018/08/29~
https://gist.github.com/daisukenishino2/d50bfcfa415902abfdee0e27ed48a715
-2019/03/03~
https://gist.github.com/daisukenishino2/f09fb400fa2186aead4b6f8cad59ab38

https://twitter.com/openhishopjpo/status/1101432292419895296

**ストア [#sabce498]
https://github.com/abergs/fido2-net-lib/blob/master/fido2-net-lib/DevelopmentInMemoryStore.cs

***storedUsers [#q08825b4]
-DevelopmentInMemoryStoreをデモ実装にして、本体側は、IUserStore的なInterfaceのみにした方が良さそう。
-一先ず、WebAuthnStoreを実装して、内部をUserStoreType (mem, sql, ora, npg) でSwitch。

***メンバ [#q8b8b540]
-storedUsers
 ConcurrentDictionary<string, User> storedUsers = new ConcurrentDictionary<string, User>();

-User
--User
 - string Name
 - byte[] Id
 - string DisplayName

***storedCredentials [#m5060d43]
-storedCredentials
 List<StoredCredential> storedCredentials = new List<StoredCredential>();

-StoredCredential
--StoredCredential
 - byte[] UserId
 - PublicKeyCredentialDescriptor Descriptor
 - byte[] PublicKey
 - byte[] UserHandle
 - uint SignatureCounter
 - string CredType
 - DateTime RegDate
 - Guid AaGuid

-PublicKeyCredentialDescriptor 
--PublicKeyCredentialDescriptor 
 - PublicKeyCredentialType? Type(enum)
 - byte[] Id
 - AuthenticatorTransport[] Transports

***メソッド [#b9983100]
-User
 - User GetUser
 - User GetOrAddUser(string username, Func<User> addCallback)
 - List<User> GetUsersByCredentialIdAsync(byte[] credentialId)

-StoredCredential
 - List<StoredCredential> GetCredentialsByUser(User user)
 - List<StoredCredential> GetCredentialsByUserHandleAsync(byte[] userHandle)
 - StoredCredential GetCredentialById(byte[] id)
 - void AddCredentialToUser(User user, StoredCredential credential)
 - void UpdateCounter(byte[] credentialId, uint counter)

**サーバ [#g0b69f2d]
https://github.com/abergs/fido2-net-lib/blob/master/Fido2Demo/Controller.cs

-[[Server Requirements and Transport Binding Profile>WebAuthnを実装する。#c50d2962]]との乖離がある。

***MakeCredentialOptions [#f89b4f96]
+Get from DB by username (ユーザ名でDBから取得)
--user (in our example, auto create missing users)~
(ユーザ (この例では、見つからないユーザを自動作成))
--keys (キー)~
~
+Create options (MakeCredentialOptionsを作成)~
~
+Temporarily store options, session/in-memory cache/redis/db~
(session/in-memory cache/redis/dbの一時保存オプション)~
~
+return options to client~
(クライアントにMakeCredentialOptionsを返す)

***MakeCredential [#m0f94989]
+get the options we sent the clientt~
(クライアントに送信したMakeCredentialOptionsを取得)~
~
+Create callback so that lib can verify credential id is unique to this user~
(信任状IDがこのユーザに固有であることをlibが検証できるようにcallbackを作成。)~
~
+Verify and make the credentials~
(認証情報を確認して作成)~
~
+Store the credentials in db~
(資格情報をdbに格納)~
~
+return "ok" to the client~
(クライアントに "ok"を返す)

***AssertionOptionsPost [#ue95e631]
+Get from DB (DBから取得)
--user (ユーザ)
--registered credentials (登録済み資格情報)~
~
+Create options (AssertionOptionsを作成)~
~
+Temporarily store options, session/in-memory cache/redis/db~
(session/in-memory cache/redis/dbの一時保存オプション)~
~
+Return options to client~
(クライアントにAssertionOptionsを返す)

***MakeAssertion [#xad0155b]
+Get the assertion options we sent the client~
(クライアントに送信したAssertionOptionsを取得)~
~
+Get from database (DBから取得)
--Registered credential (登録済み資格情報)
--Credential counter (資格情報カウンタ)~
~
+Create callback to check if userhandle owns the credentialId~
(userhandleがcredentialIdを所有しているかどうかを確認するcallbackを作成)~
~
+Make the assertion~
(アサーションをする)~
~
+Store the updated counter~
(更新したカウンタを保存)~
~
+return OK to client~
(クライアントに "ok"を返す)

*参考 [#offce323]

-NuGet Gallery
--Fido2~
https://www.nuget.org/packages/Fido2/
--Fido2NetLib~
登録ミス(若しくはリネーム

**abergs/fido2-net-lib [#ya9daac1]

***GitHub [#r39a2358]
abergs/fido2-net-lib: FIDO2 .NET library for FIDO2 / WebAuthn Attestation and Assertion using .NET~
https://github.com/abergs/fido2-net-lib

-本体~
https://github.com/abergs/fido2-net-lib/tree/master/fido2-net-lib
-デモ~
https://github.com/abergs/fido2-net-lib/tree/master/Fido2Demo

--FIDO2 .NET lib Demo~
https://fido2.azurewebsites.net/
***FIDO2 .NET lib Demo [#d07138b7]
-https://fido2.azurewebsites.net/
-http://fido2test.azurewebsites.net/overview

***Ideas Of Anders Åberg [#g5d6b13c]
Latest Posts~
http://ideasof.andersaberg.com/

-FIDO2 - Things I learned by building a FIDO2 server~
http://ideasof.andersaberg.com/development/fido2-net-library
-The passwordless web is coming~
http://ideasof.andersaberg.com/development/the-passwordless-web

**過去ログ [#uc47daf9]

***セットアップ [#jf3b01c9]
https://twitter.com/openhishopjpo/status/1101432292419895296

***分析 [#p5ac3be2]
現在、分析中。
-2018/08/29~
https://gist.github.com/daisukenishino2/d50bfcfa415902abfdee0e27ed48a715
-2019/03/03~
https://gist.github.com/daisukenishino2/f09fb400fa2186aead4b6f8cad59ab38

***フィードバック [#of8e9f72]
-Phase1~
https://gist.github.com/daisukenishino2/204f16d612831421ab7451861a29c001

-Phase2~
...MDS実装や、様々なオプションでのテストなどを予定...

**Open棟梁への実装結果 [#o77b736a]

***Library [#nbff8c60]
https://github.com/OpenTouryoProject/MultiPurposeAuthSite/tree/develop/root/programs/CommonLibrary/Extensions/FIDO
-DataProvider.cs
-WebAuthnHelper.cs

***HTPM + WebAPI [#he87e162]
-https://github.com/OpenTouryoProject/MultiPurposeAuthSite/blob/develop/root/programs/MultiPurposeAuthSite/MultiPurposeAuthSite/Views/Home/WebAuthnStarters.cshtml
-https://github.com/OpenTouryoProject/MultiPurposeAuthSite/blob/develop/root/programs/MultiPurposeAuthSite/MultiPurposeAuthSite/Controllers/Fido2ServerController.cs

***Script [#f9cab640]
-https://github.com/OpenTouryoProject/MultiPurposeAuthSite/blob/develop/root/programs/MultiPurposeAuthSite/MultiPurposeAuthSite/Scripts/touryo/arrayBufferUtil.js
-https://github.com/OpenTouryoProject/MultiPurposeAuthSite/blob/develop/root/programs/MultiPurposeAuthSite/MultiPurposeAuthSite/Scripts/touryo/webauthn.js

----
Tags: [[:IT国際標準]], [[:認証基盤]]


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