久久久久久久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 應用程序在通過管理門戶更新之前無法運行)
主站蜘蛛池模板: 天天爽综合网 | 伊色综合久久之综合久久 | 日韩成人一区 | 欧美精品video | 国产精品久久久久久久久久久久 | 成人网av | 国产九九九九 | 日日干夜夜操 | 欧美日韩一区二区三区不卡视频 | 综合二区 | 欧美一区二区三区四区五区无卡码 | 99re国产| 欧美日韩精品一区 | 亚洲一区二区三区久久 | 久草网免费 | 天天夜夜人人 | 久久精品小视频 | 1204国产成人精品视频 | 99精品视频免费观看 | 精品国产91乱码一区二区三区 | 国产一区二区在线视频 | 国产免费一区二区 | 精品一区二区三 | 无码日韩精品一区二区免费 | 一级a性色生活片久久毛片 一级特黄a大片 | 在线小视频 | 日本免费视频在线观看 | 欧美在线一区二区三区 | 成人99| 精品国产乱码久久久久久88av | 日本在线观看视频 | 第四色播日韩第一页 | 日韩在线观看 | 激情视频网站 | 狠狠干网站 | 色播久久 | 91中文视频| 国产一区999| 欧美久久一级特黄毛片 | 日韩视频91 | 亚洲欧美日韩在线不卡 |