久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

Azure Active Directory 與 MVC,客戶端和資源標識同一

Azure Active Directory with MVC, the client and resource identify the same application(Azure Active Directory 與 MVC,客戶端和資源標識同一個應用程序)
本文介紹了Azure Active Directory 與 MVC,客戶端和資源標識同一個應用程序的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

限時送ChatGPT賬號..

跟進這個問題:

如何在 ASP.NET MVC 上執行 Azure Active Directory 單點登錄和表單身份驗證

我嘗試在默認 MVC 4 的登錄操作上編寫簡單代碼,該操作同時使用默認表單身份驗證和 Azure Active Directory SSO:

I have tried writing the simple code on Login action of default MVC 4 which uses both default Forms Authentication and Azure Active Directory SSO:

public async Task<ActionResult> Login(LoginModel model, string returnUrl)
{
    if (ModelState.IsValid && WebSecurity.Login(model.UserName, model.Password, persistCookie: model.RememberMe))
    {
        return RedirectToLocal(returnUrl);
    }

    authContext = new AuthenticationContext(authority, new TokenCache());
    var result = await authContext.AcquireTokenAsync(resourceId, clientId, new UserCredential(model.UserName, model.Password));

    // more code
}

因此,如果正常登錄 WebSecurity.Login 不成功,我會嘗試通過使用 ADAL.NET 和以下帖子的憑據(用戶名/密碼)從 AAD 獲取令牌:http://www.cloudidentity.com/blog/2014/07/08/using-adal-net-to-authenticate-users-via-usernamepassword/

So if the normal Login WebSecurity.Login is not successful, I try to acquire token from AAD by using ADAL.NET with credential (username/password) following this post: http://www.cloudidentity.com/blog/2014/07/08/using-adal-net-to-authenticate-users-via-usernamepassword/

運行應用程序時,我從 Azure 收到錯誤:

When running application I got the error from Azure:

AADSTS90027:客戶端[ClientId]"和資源[ResouceId]"標識同一個應用程序.

AADSTS90027: The client '[ClientId]' and resource '[ResouceId]' identify the same application.

我不確定直接在 MVC 登錄操作上使用 ADAL 和憑據是否真的有意義.請有人給我這個東西的提示.

I am not sure whether it really makes sense to use ADAL with credential directly on MVC Login action. Please someone give me a hint on this stuff.

推薦答案

ADAL 并不是為了在 Web 應用程序中實現 Web 登錄.ADAL 幫助應用程序獲取訪問另一個資源的令牌:換句話說,它幫助您的應用程序成為客戶端.此外,用戶名/密碼在 Web 應用程序中不可用,因為它只能在本機應用程序中使用.為了同時使用 FormsAuth 和 Azure AD,請考慮添加 ASP.NET 身份中間件和 OpenId Connect 中間件.OpenId Connect 中間件是用于通過 Azure AD 實現 Web SSO 的庫.

ADAL is not meant to achieve web sign-on in a web application. ADAL helps an application to obtain a token for accessing another resource: in other words, it helps your application to be a CLIENT. Moreover, the username/password is not available in web apps as it is meant to be used only in native applications. In order to use both FormsAuth and Azure AD, please consider adding both the ASP.NET identity middleware and the OpenId Connect middleware. The OpenId Connect middleware is the library one should use for achieving web SSO with Azure AD.

這篇關于Azure Active Directory 與 MVC,客戶端和資源標識同一個應用程序的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

ASP.NET Core authenticating with Azure Active Directory and persisting custom Claims across requests(ASP.NET Core 使用 Azure Active Directory 進行身份驗證并跨請求保留自定義聲明)
ASP.NET Core 2.0 Web API Azure Ad v2 Token Authorization not working(ASP.NET Core 2.0 Web API Azure Ad v2 令牌授權不起作用)
How do I get Azure AD OAuth2 Access Token and Refresh token for Daemon or Server to C# ASP.NET Web API(如何獲取守護進程或服務器到 C# ASP.NET Web API 的 Azure AD OAuth2 訪問令牌和刷新令牌) - IT屋-程序員軟件開發技
Azure KeyVault Active Directory AcquireTokenAsync timeout when called asynchronously(異步調用時 Azure KeyVault Active Directory AcquireTokenAsync 超時)
Getting access token using email address and app password from oauth2/token(使用電子郵件地址和應用程序密碼從 oauth2/token 獲取訪問令牌)
New Azure AD application doesn#39;t work until updated through management portal(新的 Azure AD 應用程序在通過管理門戶更新之前無法運行)
主站蜘蛛池模板: 亚洲精品一区二区三区免 | 瑟瑟免费视频 | 日韩在线不卡 | 91xh98hx 在线 国产 | av网址在线 | 成人精品一区二区三区中文字幕 | www.99热这里只有精品 | 一本大道久久a久久精二百 国产成人免费在线 | www.中文字幕.com| 91精品久久久久久久久 | 国产一区二区日韩 | 亚洲欧美日韩高清 | 国产中文字幕在线 | 国产成人精品一区二区三区 | 亚洲一二三区精品 | 亚洲激情专区 | www97影院 | 日本不卡视频在线播放 | 成人国产精品色哟哟 | 九九热免费视频在线观看 | 亚洲精品一区二区三区蜜桃久 | 黄篇网址 | 国产精品国产 | 一区二区福利视频 | 国产精品v | 日本大香伊一区二区三区 | 亚洲成人中文字幕 | 99精品国产一区二区三区 | 日韩精品成人网 | 99久久精品国产一区二区三区 | 亚洲女人天堂成人av在线 | 91 中文字幕 | www97影院 | 中文字幕av网 | 久久精品国产清自在天天线 | 91精品久久久久久久久 | 国产成人一区二 | a免费视频 | 成人国产精品入口免费视频 | 毛片毛片毛片毛片毛片 | 亚洲一区二区电影在线观看 |