0
我在Azure Active Directory網站配置回覆URL中指定了兩個URL。當我運行本地代碼時,一個重定向到我的localhost環境,另一個在運行prod網站時重定向到我的Azure託管網站。但Azure Active Directory似乎忽略了該設置。它僅使用一個或另一個URL但不能同時 這是我startup.Auth.csAzure Active Directory網站重定向意外
public partial class Startup
{
private static string clientId = ConfigurationManager.AppSettings["ida:ClientId"];
private static string aadInstance = ConfigurationManager.AppSettings["ida:AADInstance"];
private static string tenantId = ConfigurationManager.AppSettings["ida:TenantId"];
private static string postLogoutRedirectUri = ConfigurationManager.AppSettings["ida:PostLogoutRedirectUri"];
private static string authority = aadInstance + tenantId;
public void ConfigureAuth(IAppBuilder app)
{
app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);
app.UseCookieAuthentication(new CookieAuthenticationOptions());
AntiForgeryConfig.UniqueClaimTypeIdentifier = ClaimTypes.GivenName;
app.UseOpenIdConnectAuthentication(
new OpenIdConnectAuthenticationOptions
{
ClientId = clientId,
Authority = authority,
PostLogoutRedirectUri = postLogoutRedirectUri,
TokenValidationParameters = new TokenValidationParameters
{
RoleClaimType = "roles"
},
});
}
}
,這我startup.cs
public void Configuration(IAppBuilder app)
{
ConfigureAuth(app);
}
,最後,這是我的web.config設置
<appSettings>
<add key="ida:ClientId" value="*************************" />
<add key="ida:AADInstance" value="https://login.microsoftonline.com/" />
<add key="ida:AppKey" value="******************************" />
<add key="ida:TenantId" value="****************************" />
<add key="ida:PostLogoutRedirectUri" value="url of production website" />
<add key="ida:Domain" value="company domain" />
</appSettings>
我不知道爲什麼這種重定向發生