【发布时间】:2019-04-09 15:40:55
【问题描述】:
如何将 Asp.Net Identity 与 Azure AD 授权集成
是否可以通过 OpenIdConnect 将 Asp.Net Identity 与 Azure AD 授权集成?我想要一个用于本地授权的两个授权提供程序(通过标准 Asp.net 核心身份,第二个通过 Azure AD
_services
.AddAuthentication(options =>
{
options.DefaultAuthenticateScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.DefaultChallengeScheme = OpenIdConnectDefaults.AuthenticationScheme;
options.DefaultScheme = CookieAuthenticationDefaults.AuthenticationScheme;
})
.AddOpenIdConnect(OpenIdConnectDefaults.AuthenticationScheme, options =>
{
options.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme;
options.ClientId = clientId;
options.ClientSecret = clientSecret;
options.Authority = $"{baseAuthorityUrl}/{tenantId}/v2.0";
options.CallbackPath = new PathString(callBackPath);
options.Scope.Add("email");
options.Scope.Add("profile");
options.ResponseType = "code id_token";
options.SaveTokens = true;
options.GetClaimsFromUserInfoEndpoint = true;
options.TokenValidationParameters = new TokenValidationParameters
{
NameClaimType = "name"
};
})
这适用于 Azure AD 授权,但我无法将授权方法从 Azure AD 更改为 ASp.Net Identity。非常感谢任何帮助
【问题讨论】:
标签: c# asp.net-core asp.net-identity