0

私たちは個別認証が有効でサポートされているGoogle、twitterなどを使用してMVCアプリケーションを作成しました。同じAzureアプリケーションでもAzure ADにサポートを拡張したいと考えています。コードを広範囲に変更せずにこれを達成する方法。 コードは次のとおりです(サードパーティ認証を有効にするためにOAuth、Owinミドルウェアを使用しています)。それは簡単に(アプリケーションがマルチテナントをサポートする必要がありますのでご注意ください。)MVCの個別認証とAzure AD

app.UseGoogleAuthentication(new GoogleOAuth2AuthenticationOptions() 
     { 
      ClientId = "xxxxxxxxxxxxxxxxx.apps.googleusercontent.com", 
      ClientSecret = "xxxxxxxxxxxxx", 
      Provider = new GoogleOAuth2AuthenticationProvider() 

     }); 
var facebookAuthenticationOptions = new FacebookAuthenticationOptions() 
     { 
      AppId = "xxxxxxxxx", 
      AppSecret = "xxxxxxxxxxxxxxxxxxxxxx", 

      AuthenticationType = "Facebook", 
      SignInAsAuthenticationType = DefaultAuthenticationTypes.ExternalCookie, 

      Provider = new FacebookAuthenticationProvider 
      {.... 

のAzure AD認証のために拡張することができます。..

enter image description here

あなたの貴重なコメントは、

+0

これは質問ではありません。言い換えれば、遭遇した問題を正確に追加できますか? –

答えて

1

はい歓迎されていますAzure AD認証を追加することができます。マルチテナントあなたはcommonを持っている必要があるアプリケーションの代わりに、{0}については

services.AddAuthentication() 
    .AddOpenIdConnect(
     o => 
     { 
      o.ClientId = Configuration["AzureAd:ClientId"]; 
      o.Authority = String.Format(
       "https://login.microsoftonline.com/{0}", Configuration["AzureAd:Tenant"]); 
      o.SignedOutRedirectUri = Configuration["AzureAd:PostLogoutRedirectUri"]; 
      o.Events = new OpenIdConnectEvents() 
      { 
       OnRemoteFailure = OnRemoteAuthenticationFailure, 
      }; 
     }); 

:AzureのADにオープンIDの接続を追加するASP.NETコア・アイデンティティで

は、 Startup.csConfigureServices方法でこれらの線と同じくらい簡単です Authorityにあり、アプリケーションが定義されているテナントを示すいくつかの追加設定があります。

+0

ありがとうございます! owin.Appbuilderを使用して何かを得る方法がありますか – user3527063

関連する問題