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

使用 Azure Active Directory - 一個應用程序在本地登錄

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

問題描述

限時送ChatGPT賬號..

我正在使用 Azure Active Directory 身份驗證構建 MVC 應用程序.當我在本地開發時,我希望能夠登錄以進行測試/開發.應用 url 類似于 http://localhost:43400.這也在 Sign-On UrlReply Url 中的 AD 應用程序中進行了編碼.

當我將同一個應用程序部署到服務器時,應用程序 url 發生了變化 - 變成類似于 myappname.azurewebsites.net 的東西,我無法使用同一個 AD 應用程序登錄.我能做到的最好的辦法是通過登錄過程,但隨后 AD 將我重定向回 localhost:43400 這是錯誤的.

Startup.Auth.cs 中有 PostLogoutRedirectUri 屬性,我提供給應用程序,但它根本沒有區別.

有什么方法可以讓本地應用程序和部署的應用程序使用同一個 Azure AD?

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

UPD

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

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

查看完整的代碼清單

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

解決方案

您可以向您的應用添加多個重定向 uri,這就是該屬性被實現為列表的原因!您只需要確保指定在運行時使用哪個 URI.您可以通過多種方式做到這一點 - 您可以在中間件初始化時指定返回 URI,或者您可以添加將在登錄消息中注入重定向 URI 的動態代碼.有關后一種方法的示例,請參閱 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

這篇關于使用 Azure Active Directory - 一個應用程序在本地登錄并在發布時登錄的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 令牌授權不起作用)
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(如何獲取守護進程或服務器到 C# ASP.NET Web API 的 Azure AD OAuth2 訪問令牌和刷新令牌) - IT屋-程序員軟件開發技
.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(異步調用時 Azure KeyVault Active Directory AcquireTokenAsync 超時)
主站蜘蛛池模板: 9191av| 一区二区三区四区不卡视频 | 国产日韩欧美在线 | 一区二区三区在线观看免费视频 | 久久精品久久久 | 亚洲乱码国产乱码精品精的特点 | 久久夜夜 | 欧产日产国产精品视频 | 欧美一区不卡 | 成人国产午夜在线观看 | 中文字幕欧美一区 | 日韩在线中文字幕 | a级黄色网 | 91精品国产乱码久久久久久久久 | 国产激情综合五月久久 | 国产三级国产精品 | 国内精品久久久久久影视8 最新黄色在线观看 | 成人夜晚看av | 国产精品一区二区三区四区 | 在线视频 亚洲 | www.青青草| 久久精品免费 | 国产精品毛片无码 | 99国产视频 | 9999久久| 日韩欧美视频 | 日韩一区二区在线观看视频 | 国产精品亚洲成在人线 | 免费亚洲成人 | 日韩成人av在线 | 视频三区 | 国产精品久久久久久久久久久久冷 | 精品一区二区三区视频在线观看 | 成人水多啪啪片 | 最新国产精品精品视频 | 日韩在线视频观看 | 日韩高清国产一区在线 | 午夜看电影在线观看 | 久久99久久 | 日韩三级一区 | 亚洲精品无|