2017-05-08 28 views
0

我需要使用ADAL中可用的高級身份驗證方案,這些方案在MSAL中不可用。我目前使用Azure AD v1(ADAL)進行身份驗證。我如何添加對Outlook.com帳戶的支持?

此外,我希望有一個outlook.com用戶(live.com /個人賬戶)才能登錄。

Live SDK isn't available,但我能夠創建新的應用程序標識符within the portal

問題

  • 如果我的目標是支持ADALv1,並且還支持LiveID的賬戶,我應該走哪條路?

我在考慮擁有一個類似於Azure和Office已經做過的雙頁面認證屏幕,並查詢如下所示的電子郵件地址。

http://odc.officeapps.live.com/odc/emailhrd/getidp?hm=0&[email protected] 

https://login.microsoftonline.com/[email protected] 

如果在AD中只有一個用戶帳戶,那麼我會透明地重定向到AzureAD。

如果在Outlook.com/live.com中只有一個帳戶,那麼我將在那裏重定向。

回答

0

不知道你在處理什麼限制。但是,您提到的門戶是註冊Azure AD V2.0端點的應用程序。

在您的方案中提供單獨的按鈕以登錄Azure AD帳戶有幫助嗎?如果是的話,你可以參考下面的代碼:

提供兩個按鈕來選擇哪個帳戶登入:

<input type="button" value="AzureAD" onclick="location.href='@Url.Action("SignIn", "Account",new { provider="aad"})'" /> 
<input type="button" value="Microsoft" onclick="location.href='@Url.Action("SignIn", "Account",new { provider="microsoft"})'" /> 

帳戶控制:

public void SignIn(string provider,string ReturnUrl = "/") 
{ 
    if (!Request.IsAuthenticated) 
    { 
     if ("aad" == provider) 
      HttpContext.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = ReturnUrl }, OpenIdConnectAuthenticationDefaults.AuthenticationType); 
     else 
      HttpContext.GetOwinContext().Authentication.Challenge(new AuthenticationProperties { RedirectUri = ReturnUrl }, "Microsoft"); 
    } 
} 

Startup.cs

app.UseMicrosoftAccountAuthentication(
     clientId: "", 
     clientSecret: ""); 

    app.UseOpenIdConnectAuthentication(new OpenIdConnectAuthenticationOptions 
    { 
     ClientId = "", 
     Authority = "", 
    }); 
相關問題