我使用OpenID进行AD身份验证的.NET核心Web应用程序存在问题.目前,在我的应用程序设置中,CallBackPath设置为/ signin-oidc
"Authentication": {
"AzureAd": {
"AADInstance": "microsoftonlinecom/",
"CallbackPath": "/signin-oidc"
Run Code Online (Sandbox Code Playgroud)
在azure上,replyurl设置为azurewebsitescom/signin-oidc
每当我将replyurl更改为localhost:44320/signin-oidc并在本地调试时,它运行良好但在Azure上我收到以下错误:
azurewebsitesnet/.auth/login/aad/callback'与为应用程序配置的回复地址不匹配:'
因为你可以告诉它使用不正确的回复,我不知道为什么它不会使用在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
});
Run Code Online (Sandbox Code Playgroud)
此外,如果我添加一个通配符回复URL,例如exampleazurewebsitesnet/*,那么我可以对我的应用程序进行身份验证,除非它声明我没有访问权限且回复仍然是上面的错误:azurewebsitesnet/.auth/login/aad/callback
"您无权查看此目录或页面."
我被迫故意输入错误的URL,因为我没有足够的权限在堆栈溢出时发布超过2个链接