azure - 从 Azure AD B2B 验证令牌颁发者
问题描述
我正在尝试验证从 Azure AD B2B 订阅获得的访问令牌,我使用的是版本 2 "accessTokenAcceptedVersion": 2,
。
我目前的验证在启动课程中进行
services
.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(o =>
{
o.Audience = "application_id";
o.Authority = "https://login.microsoftonline.com/tenant_id";
o.TokenValidationParameters = new TokenValidationParameters { ValidateIssuerSigningKey = true, ValidateIssuer = true, ValidateAudience = true, ValidateLifetime = true };
});
令牌颁发者未验证
www-authenticate: Bearer error="invalid_token"error_description="The issuer 'https://login.microsoftonline.com/tanant_id/v2.0' is invalid"
授权网址
https://login.microsoftonline.com/tanant_id/oauth2/authorize
范围在 Azure AD 中定义并由应用程序使用。
c.AddSecurityDefinition("oauth2", new OpenApiSecurityScheme
{
Type = SecuritySchemeType.OAuth2,
Flows = new OpenApiOAuthFlows
{
Implicit = new OpenApiOAuthFlow
{
AuthorizationUrl = uri,
Scopes = new Dictionary<string, string>
{
{ "Access_api", "Admins and users" },
}
}
}
});
我不确定是什么原因造成的?
解决方案
推荐阅读
- macos - 使用 -print0 将 find 的输出存储在变量中
- docker-compose - Traefik 简单的 Apache2 服务器 SSL_ERROR_INTERNAL_ERROR_ALERT
- java - Hamcrest Matchers.containsInAnyOrder 不起作用
- c# - 尝试使用 htmlagility 包识别文本节点
- scheme - “地图”是否一定会产生额外的嵌套级别?
- reactjs - Heroku Nodejs - 部署应用程序时反应错误
- javascript - Snapshot Firebase React native:“警告:遇到两个具有相同密钥的孩子”
- r - MGCV:与包括 NA 在内的因子的三向交互
- java - 我的递归回溯器有什么问题
- python - 如何正则表达式搜索此字符串?