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

使用 Azure Active Directory - 一個(gè)應(yīng)用程序在本地登錄

Using Azure Active Directory - one application to login locally and when published(使用 Azure Active Directory - 一個(gè)應(yīng)用程序在本地登錄并在發(fā)布時(shí)登錄)
本文介紹了使用 Azure Active Directory - 一個(gè)應(yīng)用程序在本地登錄并在發(fā)布時(shí)登錄的處理方法,對大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

限時(shí)送ChatGPT賬號(hào)..

我正在使用 Azure Active Directory 身份驗(yàn)證構(gòu)建 MVC 應(yīng)用程序.當(dāng)我在本地開發(fā)時(shí),我希望能夠登錄以進(jìn)行測試/開發(fā).應(yīng)用 url 類似于 http://localhost:43400.這也在 Sign-On UrlReply Url 中的 AD 應(yīng)用程序中進(jìn)行了編碼.

當(dāng)我將同一個(gè)應(yīng)用程序部署到服務(wù)器時(shí),應(yīng)用程序 url 發(fā)生了變化 - 變成類似于 myappname.azurewebsites.net 的東西,我無法使用同一個(gè) AD 應(yīng)用程序登錄.我能做到的最好的辦法是通過登錄過程,但隨后 AD 將我重定向回 localhost:43400 這是錯(cuò)誤的.

Startup.Auth.cs 中有 PostLogoutRedirectUri 屬性,我提供給應(yīng)用程序,但它根本沒有區(qū)別.

有什么方法可以讓本地應(yīng)用程序和部署的應(yīng)用程序使用同一個(gè) Azure AD?

我可以使用不同的 url 和鍵執(zhí)行 2 個(gè) AD 應(yīng)用程序,并在部署時(shí)重寫 web.config 中的值.但這聽起來不是最好的解決方案.我還能做什么?

UPD

這是我在 Startup.Auth.cs 中所指的位:

app.UseOpenIdConnectAuthentication(新的 OpenIdConnectAuthenticationOptions{客戶 ID = 客戶 ID,權(quán)威=權(quán)威,PostLogoutRedirectUri = postLogoutRedirectUri,//<-- 這是來自 web.config,在 dev 和 prod 中不同通知 = 新 OpenIdConnectAuthenticationNotifications(){......}});

查看完整的代碼清單

但 AD 僅使用其中一個(gè)地址進(jìn)行重定向,即使客戶端指定了與其中一個(gè)記錄匹配的重定向.

解決方案

您可以向您的應(yīng)用添加多個(gè)重定向 uri,這就是該屬性被實(shí)現(xiàn)為列表的原因!您只需要確保指定在運(yùn)行時(shí)使用哪個(gè) URI.您可以通過多種方式做到這一點(diǎn) - 您可以在中間件初始化時(shí)指定返回 URI,或者您可以添加將在登錄消息中注入重定向 URI 的動(dòng)態(tài)代碼.有關(guān)后一種方法的示例,請參閱 https://github.com/AzureADSamples/WebApp-MultiTenant-OpenIdConnect-DotNet/blob/master/TodoListWebApp/App_Start/Startup.Auth.cs

I'm building an MVC application with Azure Active Directory authentication. When I develop locally I would like to be able to sign-in for testing/development purposes. And the app url is like http://localhost:43400. This is also encoded in the AD application in Sign-On Url and Reply Url.

When I deploy the same app to the server, the app url is changed - becomes something like myappname.azurewebsites.net and I can't login using the same AD application. The best I could manage is to get through login process, but then AD redirects me back to localhost:43400 which is wrong.

There is PostLogoutRedirectUri property in Startup.Auth.cs that I give to the app, but it makes no difference at all.

Any way to have local application and deployed application using the same Azure AD?

I can do 2 AD Applicaitons with different urls and keys and rewrite the values in web.config on deploy. But that does not sound like the best solution. Anything else I can do?

UPD

Here is the bit I'm referring to in Startup.Auth.cs:

app.UseOpenIdConnectAuthentication(
    new OpenIdConnectAuthenticationOptions
    {
        ClientId = clientId,
        Authority = Authority,
        PostLogoutRedirectUri = postLogoutRedirectUri, // <-- this is coming from web.config, different in dev and prod

        Notifications = new OpenIdConnectAuthenticationNotifications()
        {
            .....

        }
    });

See full code listing here.

And in Azure AD application I tried both addresses as a Reply URL at the same time:

But the AD used only one of the addresses to redirect, even though the client specified the redirection that matches one of the records.

解決方案

You can add multiple redirect uri to your app, that's why the property is implemented as a list! You just need to make sure that you specify which URI to use at runtime. You can do that in many ways - you can specify the return URI at middleware init time, or you can add dynamic code that will inject a redirect URI in the sign in message. For an example of the latter approach, please see RedirectToIdentityProvider in https://github.com/AzureADSamples/WebApp-MultiTenant-OpenIdConnect-DotNet/blob/master/TodoListWebApp/App_Start/Startup.Auth.cs

這篇關(guān)于使用 Azure Active Directory - 一個(gè)應(yīng)用程序在本地登錄并在發(fā)布時(shí)登錄的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

ASP.NET Core authenticating with Azure Active Directory and persisting custom Claims across requests(ASP.NET Core 使用 Azure Active Directory 進(jìn)行身份驗(yàn)證并跨請求保留自定義聲明)
ASP.NET Core 2.0 Web API Azure Ad v2 Token Authorization not working(ASP.NET Core 2.0 Web API Azure Ad v2 令牌授權(quán)不起作用)
ASP Core Azure Active Directory Login use roles(ASP Core Azure Active Directory 登錄使用角色)
How do I get Azure AD OAuth2 Access Token and Refresh token for Daemon or Server to C# ASP.NET Web API(如何獲取守護(hù)進(jìn)程或服務(wù)器到 C# ASP.NET Web API 的 Azure AD OAuth2 訪問令牌和刷新令牌) - IT屋-程序員軟件開發(fā)技
.Net Core 2.0 - Get AAD access token to use with Microsoft Graph(.Net Core 2.0 - 獲取 AAD 訪問令牌以與 Microsoft Graph 一起使用)
Azure KeyVault Active Directory AcquireTokenAsync timeout when called asynchronously(異步調(diào)用時(shí) Azure KeyVault Active Directory AcquireTokenAsync 超時(shí))
主站蜘蛛池模板: 久久精品在线 | 91免费看片神器 | 亚洲aⅴ| 中文字幕日韩欧美 | 亚洲免费在线观看 | 成人免费淫片aa视频免费 | 欧美成人自拍 | 精品综合在线 | wwwxx在线观看 | 美国a级毛片免费视频 | 国产美女在线观看 | 亚洲一区欧美 | 丝袜毛片| 能免费看的av | 美女在线观看av | www.午夜| 欧美日韩在线看 | 亚洲一区精品视频 | 在线不卡视频 | 激情91| 精品综合久久久 | 在线观看成人 | 久久国产精品偷 | 欧美一区二区三区大片 | 天堂成人国产精品一区 | 欧美一区二区在线 | 中文天堂在线一区 | www久久99 | 一级毛片播放 | 国产成人99久久亚洲综合精品 | 在线一区 | 一区二区三区av夏目彩春 | 国产一区二区毛片 | 婷婷色综合 | 免费成人在线网站 | 日韩在线一区二区 | 中文字幕久久久 | 国产日韩精品一区 | 久久久久久久久国产成人免费 | 特黄视频| 精品国产乱码久久久 |