【发布时间】:2018-01-20 06:25:17
【问题描述】:
我有一个内置在 .Net 框架中的 web api,它在授予对控制器的访问权限之前验证令牌。
我正在使用 OWIN 中间件来使用 JWT 承载身份验证。
var tvps = new TokenValidationParameters
{
// The web app and the service are sharing the same clientId
ValidAudience = clientId,
ValidateIssuer = false,
};
app.UseOAuthBearerAuthentication(new OAuthBearerAuthenticationOptions
{
AccessTokenFormat = new Microsoft.Owin.Security.Jwt.JwtFormat(tvps, new OpenIdConnectCachingSecurityTokenProvider("https://login.microsoftonline.com/common/v2.0/.well-known/openid-configuration")),
});
我不得不将 ValidateIssuer 设置为 false,因为我不知道用户从哪个租户登录。
这是否意味着我不应该对发行人进行任何检查?之后我应该怎么做以及如何做?
我从这个link得到了上面的源代码。
【问题讨论】: