[[Open棟梁Project>http://opentouryo.osscons.jp/]] - [[マイクロソフト系技術情報 Wiki>http://techinfoofmicrosofttech.osscons.jp/]] -[[戻る>OWIN]] * 目次 [#oa9565ec] #contents *概要 [#wf88fe34] -フォーム認証ではなく、OWINの認証用ミドルウェア(Owin.Security)を使用している。 -特に、ソーシャルログインを行う場合、OWINで提供されるライブラリを使用する必要がある。 --Microsoft.Owin.Security.OAuth --Microsoft.Owin.Security.Facebook --Microsoft.Owin.Security.Google --Microsoft.Owin.Security.Twitter --Microsoft.Owin.Security.MicrosoftAccount **特徴 [#e0ffc016] ***One ASP.NET Identity System [#ab6e465b] ASP.NET frameworks ( ASP.NET MVC, Web Forms, Web Pages, Web API and SignalR ) で使用可能。 ***ユーザーに関するプロファイルデータを容易にプラグイン可能 [#b648e135] Entity Frameworkのコードファーストを使用し、POCOクラスを拡張することが可能。 ***永続化の制御 [#qe73efd1] -すべてのユーザー情報をデータベース内に格納 -Entity FrameworkのCodefirstを使用 -別のストレージ・プロバイダーにプラグイン可能。 ***ユニットテスト容易性 [#wc0e4c35] ***シンプルなロールプロバイダ [#w1380d26] 簡単に、「管理者」等のロールを作成し、ロールにユーザを追加ができる。 ***クレームベース認証 [#rf5e3362] クレームベース認証をサポート ***外部ログイン [#j8540631] 簡単に、マイクロソフトアカウント、FacebookやTwitterやGoogleなどの外部ログインを追加できる。 **機能 [#l1b690dc] ***機能 [#o62e1016] -サインアップ -サインイン・サインアウト -アカウントの編集 ***2.0での新機能 [#w2109450] -サインアップの機能強化 --2段階認証 --アカウント確認(E-Mail Confirmation) --パスワード検証 --ユーザー名の重複不可設定 -運用 --アカウント・ロックアウト --パスワード・リセット --アカウント削除 ***[[ASP.NET Forms認証]]との違い [#vbee03ec] -.NET Web Development and Tools Blog~ Understanding OWIN Forms authentication in MVC 5~ https://blogs.msdn.microsoft.com/webdev/2013/07/03/understanding-owin-forms-authentication-in-mvc-5/ |No.|Features|Asp.Net Forms Authentication|OWIN Forms Authentication|h |1|Cookie Authentication|Yes|Yes| |2|Cookieless Authentication|Yes|BGCOLOR(red):No| |3|Expiration|Yes|Yes| |4|Sliding Expiration|Yes|Yes| |5|Token Protection|Yes|Yes| |6|Claims Support|BGCOLOR(red):No|Yes| |7|Web Farm Support|Yes|Yes| |8|Unauthorized Redirection|Yes|Yes| **資格情報へのアクセス [#w4a7fdb2] [[Entity Framework]](Microsoft.AspNet?.Identity.EntityFramework)が使用されており、~ [[Entity Framework]]マイグレーションを使うことで、簡単にユーザー情報に項目を追加できる。 また、任意のストレージを使用するようにカスタマイズできる。~ この際に、[[Entity Framework]]をキャンセルすることもできる。 *実装 [#h9bcf6f6] **サインアップの機能強化 [#q361d57e] ***2段階認証 [#z03ea4a7] ***アカウント確認(E-Mail Confirmation) [#ddd90dce] ***パスワード検証 [#k87590d7] **運用 [#q46c248b] ***アカウントの編集 [#gce1e37b] ***アカウント・ロックアウト [#i8de4e90] ***パスワード・リセット [#n62fe168] ***アカウント削除 [#ubaaa54f] *[[OWIN is dead ?>OWIN#o8448c24]] [#id9d200a] **ASP.NET Core [#c1faad1c] -ASP.NET 5 ([[ASP.NET Core]]) ではバージョン3.0になり、新たに実装しなおされた。 --バージョン2.xまでの[[OWIN]]のパイプライン処理をベースとした実装ではなく、~ ASP.NET 5 ([[ASP.NET Core]]) のパイプライン処理をベースに実装されている。 --この結果、バージョン2.x向けに独自に実装したコードとの互換性が無くなった。 -ASP.NET 5([[ASP.NET Core]])でも既存コードを利用したい場合、 --バージョン3.0向けに再実装する必要がある。 --ただ、主要なAPIはそれほど変更されていないため、移植は比較的容易。 **素組 [#n763c477] OWIN が微妙ということであれば、下記のように、素組で実装できる~ (ただし、プロトコルを理解して実装を行う必要がある。下記はOAuth。)。 -Facebook Login with ASP.NET Web Forms – Nick Pinheiro~ https://blogs.msdn.microsoft.com/nickpinheiro/2015/02/28/facebook-login-with-asp-net-web-forms/ --nickpinheiro/FacebookLoginASPnetWebForms: Facebook Login with ASP.NET Web Forms~ https://github.com/nickpinheiro/FacebookLoginASPnetWebForms *参考 [#g286301f] **The ASP.NET Site [#p859f936] ASP.NET Identity~ http://www.asp.net/identity -Adding ASP.NET Identity to an Empty or Existing Web Forms Project~ http://www.asp.net/identity/overview/getting-started/adding-aspnet-identity-to-an-empty-or-existing-web-forms-project -Account Confirmation and Password Recovery with ASP.NET Identity (C#)~ http://www.asp.net/identity/overview/features-api/account-confirmation-and-password-recovery-with-aspnet-identity -Code! MVC 5 App with Facebook, Twitter, LinkedIn and Google OAuth2 Sign-on (C#) | The ASP.NET Site~ http://www.asp.net/mvc/overview/security/create-an-aspnet-mvc-5-app-with-facebook-and-google-oauth2-and-openid-sign-on **msdn.microsoft.com [#i8349da4] ***.NET Web Development and Tools Blog [#yc30addc] Introducing ASP.NET Identity – A membership system for ASP.NET applications~ https://blogs.msdn.microsoft.com/webdev/2013/06/27/introducing-asp-net-identity-a-membership-system-for-asp-net-applications/ -Customizing profile information in ASP.NET Identity in VS 2013 templates~ https://blogs.msdn.microsoft.com/webdev/2013/10/16/customizing-profile-information-in-asp-net-identity-in-vs-2013-templates/ ***Cutting Edge [#uf633eed] -ASP.NET Identity の概要~ https://msdn.microsoft.com/ja-jp/magazine/dn605872.aspx -ASP.NET Identity による外部認証~ https://msdn.microsoft.com/ja-jp/magazine/dn745860.aspx -Cutting Edge - ASP.NET Identity でのユーザー データの保存~ https://msdn.microsoft.com/ja-jp/magazine/dn818488.aspx **その他 [#s4489e6a] -新しい認証の仕組み ー ASP.NET Identity どっとねっとふぁん~ https://blogonos.wordpress.com/2013/11/29/%E6%96%B0%E3%81%97%E3%81%84%E8%AA%8D%E8%A8%BC%E3%81%AE%E4%BB%95%E7%B5%84%E3%81%BF-%E3%83%BC-asp-net-identity/ ***ASP.NET Identity入門連載一覧:CodeZine(コードジン) [#q41eac45] https://codezine.jp/article/corner/511 -「ASP.NET Identity」の登場背景と実際の使い方~ https://codezine.jp/article/detail/7709 -ASP.NET Identityによるユーザー登録/ログインの仕組み~ https://codezine.jp/article/detail/7763 -ASP.NET Identityのプロファイル情報のカスタマイズ~ https://codezine.jp/article/detail/7845 -ASP.NET Identity 2.0の新機能 ~ログインに関する検証強化とアカウントロックアウト~ https://codezine.jp/article/detail/7921 -ASP.NET Identity 2.0の新機能 ~メール連携機能のためのメール送信処理~ https://codezine.jp/article/detail/8047 -ASP.NET Identity 2.0の新機能 ~メールを使ったアカウントの確認~ https://codezine.jp/article/detail/8181 -ASP.NET Identity 2.0の新機能 ~パスワードのリセット~ https://codezine.jp/article/detail/8254 -ASP.NET Identity 2.0の新機能 ~二要素認証~ https://codezine.jp/article/detail/8328 -外部アカウントを使ったログインをASP.NET Identityで実現する~ https://codezine.jp/article/detail/8463 -ASP.NET Identityでユーザーを管理する~ https://codezine.jp/article/detail/8555 -ASP.NET Identityでユーザーに役割(ロール)を持たせる~ https://codezine.jp/article/detail/8625 -ASP.NET Identityで独自の認証処理を行う~ https://codezine.jp/article/detail/8868 -ASP.NET Identityで任意のデータストアを使う~ https://codezine.jp/article/detail/8905 -ASP.NET 5に向けて知っておきたい、最新のASP.NET Identityのポイント~ https://codezine.jp/article/detail/8966 ***ASP.NET Identity カテゴリーの記事一覧 - kendik.net [#n42a3261] http://kendik.hatenablog.com/archive/category/ASP.NET%20Identity -ASP.NET Identity のセキュリティスタンプ機能を使う~ http://kendik.hatenablog.com/entry/2014/08/17/212645 -ASP.NET Identity で二要素認証を使う - SMS 編~ http://kendik.hatenablog.com/entry/2014/08/21/033441 -ASP.NET Identity で二要素認証を使う - E-mail 編~ http://kendik.hatenablog.com/entry/2014/08/22/013330 -ASP.NET Identity を使って Microsoft アカウントで認証する~ http://kendik.hatenablog.com/entry/2014/08/25/020152 -.NET 勉強会で ASP.NET Identity の話をしてきました~ http://kendik.hatenablog.com/entry/2014/09/14/224258 -ASP.NET Identity のユーザー名、パスワードの検証機能を整理する~ http://kendik.hatenablog.com/entry/2014/09/15/223823 -Visual Studio 14 CTP 4 がリリースされたらしいですが~ http://kendik.hatenablog.com/entry/2014/10/08/022223 -ASP.NET Identity 2.2.0 (の alpha-1) が出たようです~ http://kendik.hatenablog.com/entry/2014/10/27/232558 -ASP.NET Identity beta1 が来ました~ http://kendik.hatenablog.com/entry/2014/11/13/005616 ***THE TRUTH IS OUT THERE [#l321de1c] -ASP.NET MVC で OAuth/OpenID (Facebook, Twitter, Google, Microsoft) を使う~ https://blogs.msdn.microsoft.com/chack/2012/11/19/asp-net-mvc-oauthopenid-facebook-twitter-google-microsoft/ -Visual Studio 2012 と ASP.NET で Facebook アプリを作る~ https://blogs.msdn.microsoft.com/chack/2012/12/24/visual-studio-2012-asp-net-facebook/ ***Tsmatz [#s06c46f7] ASP.NET Identity -E-Mail Confirmation の実装~ https://blogs.msdn.microsoft.com/tsmatsuz/2014/07/13/asp-net-identity-e-mail-confirmation/ -二要素認証 (2FA) の実装~ https://blogs.msdn.microsoft.com/tsmatsuz/2014/09/02/asp-net-identity-2fa/ -External Login カスタマイズ (claim, scope, access token などの活用)~ https://blogs.msdn.microsoft.com/tsmatsuz/2014/06/15/asp-net-identity-external-login-claim-scope-access-token/ -ASP.NET SPA (JavaScript) の Web API 認証~ https://blogs.msdn.microsoft.com/tsmatsuz/2014/05/20/asp-net-spa-javascript-web-api-asp-net-identity-html5biz/ ***かずきのBlog@hatena [#d042c341] -ASP.NET Identityカスタマイズに挑戦~ http://blog.okazuki.jp/entry/2013/11/10/190811 -ASP.NET Identityで独自データストアからデータを取得する(ログインからロールまで)~ http://blog.okazuki.jp/entry/2015/08/20/214212 ***Qiita [#n25a744b] -ASP.NET IdentityのUserStoreを自分で作る~ http://qiita.com/mocha/items/a56f66660f5b39d8f1fc -ASP.NET Identityを利用してTwitter認証を実装する最低限のコード~ http://qiita.com/potimarimo/items/66dc89eaba07a612de1b -ASP.NET Identityで独自認証する~ http://qiita.com/ken200/items/899762b0fd530587886d ***Series: Owin Authentication « Passion for Coding [#x78e5995] https://coding.abel.nu/series/owin-authentication/ -What’s this Owin Stuff About? -ASP.NET Identity and Owin Overview -Understanding the Owin External Authentication Pipeline -Writing an Owin Authentication Middleware -Using Owin External Login without ASP.NET Identity ***CodeProject [#z209251d] -ASP.NET MVC and Identity 2.0: Understanding the Basics~ http://www.codeproject.com/Articles/762428/ASP-NET-MVC-and-Identity-Understanding-the-Basics