0

우리는 개인 인증이 활성화되고 지원되는 google, twitter 등으로 MVC 응용 프로그램을 만들었습니다. 동일한 Azure 응용 프로그램에서도 Azure AD에 대한 지원을 확장하고 싶습니다. 코드를 광범위하게 수정하지 않고이를 달성하는 방법. 다음은 코드입니다 (타사 인증을 사용하려면 OAuth, Owin 미들웨어를 사용합니다). 쉽게 (멀티 테넌시를 지원해야하는 응용 프로그램을 유의하시기 바랍니다.)MVC의 개별 인증 및 Azure 광고

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 
      {.... 

..

enter image description here

여러분의 소중한 의견을 환영합니다

+0

이것은 질문이 아닙니다. 다시 말하면 문제가 무엇인지 정확하게 추가 할 수 있습니까? –

답변

1

있는 푸른 AD 인증을 위해 확장 될 수 있음, 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, 
      }; 
     }); 

: 푸른 광고에 오픈 ID 연결을 추가 ASP.NET 코어 정체성에

Startup.cs에서 ConfigureServices 방법이 라인만큼이나 간단합니다 Authority에 있으며 응용 프로그램이 정의 된 세입자를 나타내는 몇 가지 추가 구성이있을 수 있습니다.

+0

감사합니다. 거기 owin.Appbuilder를 사용하여 뭔가를 도착하는 방법입니다 – user3527063