Asp.net core asp.net core 3.1的多种身份验证方法(Negotiate、AzureAD)
我无法使用协商或Azure AD进行有条件授权。在Startup.cs类中,我指定Asp.net core asp.net core 3.1的多种身份验证方法(Negotiate、AzureAD),asp.net-core,.net-core,authorization,Asp.net Core,.net Core,Authorization,我无法使用协商或Azure AD进行有条件授权。在Startup.cs类中,我指定 services.AddAuthentication(options => { options.DefaultScheme = OpenIdConnectDefaults.AuthenticationScheme; options.DefaultChallengeScheme = CookieA
services.AddAuthentication(options =>
{
options.DefaultScheme = OpenIdConnectDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultSignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
})
.AddNegotiate()
.AddOpenIdConnect("AzureAD", options =>
{
options.Authority =
"https://login.microsoftonline.com/--";
options.ClientId = "--";
options.ClientSecret = "--";
options.ResponseType = OpenIdConnectResponseType.IdToken;
options.CallbackPath = "--";
options.SignedOutRedirectUri = "https://localhost:5001/";
options.TokenValidationParameters.NameClaimType = "name";
options.NonceCookie.SameSite = SameSiteMode.Unspecified;
options.CorrelationCookie.SameSite = SameSiteMode.Unspecified;
}).AddCookie();
在这种情况下,协商授权不起作用
如果我指定
services.AddAuthentication(options =>
{
options.DefaultScheme = NegotiateDefaults.AuthenticationScheme;
})
Azure广告授权停止工作。
谢谢