Azure web App .net 核心 OpenID redirect_uri 问题
Azure web App .net core OpenID redirect_uri issue
我在使用 OpenID 进行 AD 身份验证的 .NET 核心 Web 应用程序时遇到问题。目前在我的应用程序设置中,CallBackPath 设置为 /signin-oidc
"Authentication": {
"AzureAd": {
"AADInstance": "microsoftonlinecom/",
"CallbackPath": "/signin-oidc"
并且在 azure 上 replyurl 设置为 azurewebsitescom/signin-oidc
每当我将 replyurl 更改为 localhost:44320/signin-oidc 并在本地进行调试时,它运行良好,但在 Azure 上我收到以下错误:
azurewebsitesnet/.auth/login/aad/callback' 与为应用程序配置的回复地址不匹配:'
你可以告诉它使用不正确的 replyurl,我不确定为什么它不会使用在 replyurl 设置中明确设置的正确的。
startup.cs:
app.UseCookieAuthentication();
app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions
{
ClientId = Configuration["Authentication:AzureAd:ClientId"],
Authority = Configuration["Authentication:AzureAd:AADInstance"] + Configuration["Authentication:AzureAd:TenantId"],
CallbackPath = Configuration["Authentication:AzureAd:CallbackPath"],
PostLogoutRedirectUri = Configuration["Authentication:AzureAd:PostLogoutURL"],
SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme
});
此外,如果我添加通配符回复 URL,例如exampleazurewebsitesnet/* 然后我就可以对我的应用程序进行身份验证,除了它声明我没有访问权限并且 replyurl 仍然是上面的错误:azurewebsitesnet/.auth/login/aad/callback
"You do not have permission to view this directory or page."
我被迫故意输入不正确的 URLs 因为我没有足够的权限 post 超过 2 个堆栈溢出链接
根据重定向 URL,您似乎在 Azure 上部署 Web 应用后启用了 Azure 应用服务提供的 Authentication/Authorization 功能.无需配置它,因为您已经在 Web 应用程序中实现了身份验证。您可以通过新的 Azure 门户禁用它,如下图所示:
有关此功能的更多详细信息,请参阅 here。
我在使用 OpenID 进行 AD 身份验证的 .NET 核心 Web 应用程序时遇到问题。目前在我的应用程序设置中,CallBackPath 设置为 /signin-oidc
"Authentication": {
"AzureAd": {
"AADInstance": "microsoftonlinecom/",
"CallbackPath": "/signin-oidc"
并且在 azure 上 replyurl 设置为 azurewebsitescom/signin-oidc
每当我将 replyurl 更改为 localhost:44320/signin-oidc 并在本地进行调试时,它运行良好,但在 Azure 上我收到以下错误:
azurewebsitesnet/.auth/login/aad/callback' 与为应用程序配置的回复地址不匹配:'
你可以告诉它使用不正确的 replyurl,我不确定为什么它不会使用在 replyurl 设置中明确设置的正确的。
startup.cs:
app.UseCookieAuthentication();
app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions
{
ClientId = Configuration["Authentication:AzureAd:ClientId"],
Authority = Configuration["Authentication:AzureAd:AADInstance"] + Configuration["Authentication:AzureAd:TenantId"],
CallbackPath = Configuration["Authentication:AzureAd:CallbackPath"],
PostLogoutRedirectUri = Configuration["Authentication:AzureAd:PostLogoutURL"],
SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme
});
此外,如果我添加通配符回复 URL,例如exampleazurewebsitesnet/* 然后我就可以对我的应用程序进行身份验证,除了它声明我没有访问权限并且 replyurl 仍然是上面的错误:azurewebsitesnet/.auth/login/aad/callback
"You do not have permission to view this directory or page."
我被迫故意输入不正确的 URLs 因为我没有足够的权限 post 超过 2 个堆栈溢出链接
根据重定向 URL,您似乎在 Azure 上部署 Web 应用后启用了 Azure 应用服务提供的 Authentication/Authorization 功能.无需配置它,因为您已经在 Web 应用程序中实现了身份验证。您可以通过新的 Azure 门户禁用它,如下图所示:
有关此功能的更多详细信息,请参阅 here。