「[[マイクロソフト系技術情報 Wiki>http://techinfoofmicrosofttech.osscons.jp/]]」は、「[[Open棟梁Project>https://github.com/OpenTouryoProject/]]」,「[[OSSコンソーシアム .NET開発基盤部会>https://www.osscons.jp/dotNetDevelopmentInfrastructure/]]」によって運営されています。 -[[戻る>ASP.NET Core Identity]] * 目次 [#p74f5649] #contents *概要 [#ie7b7dfc] Community STSというのは、≒ OSSのSTS Middlewareと言う事。 *.NET Framework ([[ASP.NET Identity]]) [#p6107cf7] [[OAuthAuthorizationServerMiddleware>ASP.NET IdentityのOAuth2によるSTS実装]]を使用する。 -[[OAuthAuthorizationServerMiddleware>ASP.NET IdentityのOAuth2によるSTS実装]]は、[[OAuth2 基本4フロー>OAuth#c8a23ceb]]のみのサポートだった。 -しかし、昨今の、Middlewareは、[[OpenID Connect]]にも対応してきている。 *[[.NET Core]] ([[ASP.NET Core Identity]]) [#w5743ccc] [[.NET Core]]では、OSSのSTS Middlewareがリリースされている。 **ASOSとOpenIddict [#d2645897] ASOS = AspNet.Security.OpenIdConnect.Server. -Apache License 2.0 -[[OpenID Connect]]に対応している。 -OpenIddictは、ASOSをベースに使用している。~ (ASOSを単独利用という話もあってイイのかもしれないが...。) **IdentityServer4 [#ofcdeb62] -.NET Foundationの一部 -Apache License 2.0 -[[OpenID Connect]] - [[FAP1>FAPI Part 1 (Read Only API Security Profile)]]までサポート。 **その他 [#v8d0cf66] ***Cierge [#o0457744] -Cierge - passwordless authentication done right.~ https://pwdless.github.io/Cierge-Website/ -PwdLess/Cierge:~ 🗝️ Passwordless OIDC authentication done right~ https://github.com/pwdless/Cierge ***Gluu [#tad6c139] -Open source SAML, OpenID Connect, OAuth2 IDP for SSO & IAM~ https://www.gluu.org/ -Gluu, Inc.~ https://github.com/GluuFederation/ *自作と比較 [#d8f52e91] 高品質なプロダクトを作成する場合、~ 技術的[[STP>https://dotnetdevelopmentinfrastructure.osscons.jp/index.php?STP%E3%83%9E%E3%83%BC%E3%82%B1%E3%83%86%E3%82%A3%E3%83%B3%E3%82%B0]]で設計ディシジョンに対する意思決定をすべきと考える。 **利用 [#b97b79bd] [[OAuthAuthorizationServerMiddleware>ASP.NET IdentityのOAuth2によるSTS実装]]の利用で感じたこと。 ***メリット [#x89b0e2d] -OAuth2(RFC)自体を知らないところから~ ガイドされながら利用フェーズに入れる。 -その後、理解を深めるために、~ RFCを読む等する必要が出てくる。 -拡張の実装にパワーを割く必要がない~ (バージョンアップで取り込まれる)。~ ただし、勝手に新機能が取り込まれるのでもないので、~ 拡張の仕様ぐらいは抑えておく必要がある。 ※ 実際は、[[OAuthAuthorizationServerMiddleware>ASP.NET IdentityのOAuth2によるSTS実装]]は、~ 利用始めからメンテナンス・フェーズだった。 ***デメリット [#b2b9393d] -「補助輪 不可避」問題に遭遇する可能性。~ --id_tokenが挿入できない。 --拡張のgrant_typeがエラーになる。 -結局かなり深い所まで見る必要がある。 --データストア ---運用 ---クラスタリング ---[[EF>Entity Framework]]キャンセル --証明書やJWKの取り回し ---ローリング ---Windows ⇔ Linux -[[OAuthAuthorizationServerMiddleware>ASP.NET IdentityのOAuth2によるSTS実装]]は、~ メンテナンス・フェーズになったため、 --拡張は、以下のような魔改造で対応した。 ---HTTP Moduleを使用した、HTTP Responseの書換 ---AOuth2拡張用のTokenエンドポイント追加 --また、その後の度重なる、~ OAuth2拡張に対応するため、~ RFCを読んで追加実装をして行った。 **自作 [#z1a440ed] ***メリット [#ubdd2a47] 以下の点でメリットがある。 -先ず、以下の問題に遭遇しない。 --「補助輪 不可避」問題 --discon(or メンテナンス・フェーズ) -RFCの理解、実装の理解が十分にできるため、 --運用フェーズに入ってからの問題に遭遇し難い。 --Client側実装の負荷が増えつつあるが、~ Server実装を理解している方がサクサク書ける。 -その他、自作メリットと言うか、根拠的なモノ。 --認証はウワモノ臭がキツイ感がある。 --ウワモノ知識だけでは取り回しが難しい。 --フレームワークとは設計思想が違う。 ---フレームワークではなくテンプレート ---[[.NET Framework]]、[[.NET Core]]両方のサポート --魔改造で、資産が溜まっているので、~ 新規実装はあまり負担にならない。 ***デメリット [#o6c1c8f3] -自作は大変と言えば大変。 -貢献しろという話もある。 *参考 [#h7dc431d] -OAuth Authorization Service in ASP.NET Core - Stack Overflow~ https://stackoverflow.com/questions/29055477/oauth-authorization-service-in-asp-net-core -ASP.NET Core のコミュニティ OSS 認証オプション | Microsoft Docs~ https://docs.microsoft.com/ja-jp/aspnet/core/security/authentication/community -ASP.NET Blog --Bearer Token Authentication in ASP.NET Core~ https://blogs.msdn.microsoft.com/webdev/2016/10/27/bearer-token-authentication-in-asp-net-core/ --ASP.NET Core Authentication with IdentityServer4~ https://blogs.msdn.microsoft.com/webdev/2017/01/23/asp-net-core-authentication-with-identityserver4/ **ASOSとOpenIddict [#ab2a1d6e] -Kévin Chalet's blog~ https://kevinchalet.com/ -github.com~ --openiddict/openiddict-core:~ Easy-to-use OpenID Connect server for ASP.NET Core~ https://github.com/openiddict/openiddict-core --aspnet-contrib/AspNet.Security.OpenIdConnect.Server:~ OpenID Connect/OAuth2 server framework for OWIN/Katana and ASP.NET Core~ https://github.com/aspnet-contrib/AspNet.Security.OpenIdConnect.Server -NuGet Gallery --OpenIddict~ https://www.nuget.org/packages/OpenIddict/ --AspNet.Security.OpenIdConnect.Server~ https://www.nuget.org/packages/AspNet.Security.OpenIdConnect.Server/ **IdentityServer4 [#k39c8b67] -IdentityServer~ https://identityserver.io/ -Welcome to IdentityServer4 — IdentityServer4 1.0.0 documentation~ https://identityserver4.readthedocs.io/en/release/index.html -github.com --IdentityServer~ https://github.com/IdentityServer ---IdentityServer/IdentityServer4:~ OpenID Connect and OAuth 2.0 Framework for ASP.NET Core~ https://github.com/IdentityServer/IdentityServer4 -NuGet Gallery --IdentityServer4~ https://www.nuget.org/packages/IdentityServer4/ --IdentityServer4.AspNetIdentity~ https://www.nuget.org/packages/IdentityServer4.AspNetIdentity -Getting Started with IdentityServer 4 - Scott Brady~ https://www.scottbrady91.com/Identity-Server/Getting-Started-with-IdentityServer-4 -Financial APIs and IdentityServer | leastprivilege.com~ https://leastprivilege.com/2017/05/02/financial-apis-and-identityserver/ -IdentityServer4 の認証を差し替える方法 - present~ https://tnakamura.hatenablog.com/entry/2018/10/18/how-to-change-authentication-of-identityserver4 ---- Tags: [[:.NET開発]], [[:.NET Core]], [[:ASP.NET]], [[:ASP.NET MVC]], [[:ASP.NET SPA]], [[ASP.NET Web API]], [[:ASP.NET Identity]], [[:認証基盤]], [[:セキュリティ]]