【发布时间】:2019-01-12 17:48:18
【问题描述】:
我正在尝试找出使 jwt 令牌无效的最佳方法。阅读其他问题我不明白什么是最好的方法。
我的后端配置如下: 我有 3 个 Web API,其中一个配置了 asp net identity jwt。客户端要使用其他 2 个 Web API,必须先向登录 API 请求一个 jwt 令牌。
做测试我意识到如果用户请求令牌并且在重置密码后立即,令牌不会失效,因为其他 api 上的验证只考虑 issuer 和 AudienceSecret
app.UseJwtBearerAuthentication(
new JwtBearerAuthenticationOptions
{
AuthenticationMode = AuthenticationMode.Active,
AllowedAudiences = new[] { audienceId },
IssuerSecurityTokenProviders = new IIssuerSecurityTokenProvider[]
{
new SymmetricKeyIssuerSecurityTokenProvider(issuer, audienceSecret)
}
});
有没有办法使令牌失效?
感谢您的帮助
【问题讨论】:
标签: c# asp.net asp.net-identity jwt