【发布时间】:2021-10-04 02:10:36
【问题描述】:
我正在通过 IdentityServer4 发布的 AccessToken 实现受保护的 api。现在我的问题是,当我从客户端使用标头中的 Bearer 令牌调用 API 时,是否有可能通过调用内省 endopint 来恢复该值并对其进行验证?没有像这样的密钥进行自我验证:
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
// base-address of your identityserver
options.Authority = "https://demo.identityserver.io";
// if you are using API resources, you can specify the name here
options.Audience = "resource1";
// IdentityServer emits a typ header by default, recommended extra check
options.TokenValidationParameters.ValidTypes = new[] { "at+jwt" };
});
是否有任何库可以通过依赖注入在授权中间件中完成所有操作,还是我必须手动完成所有操作?我试图环顾四周,但似乎唯一的库引用了引用令牌,而不是作为 Bearer 传递的访问令牌。 谢谢
【问题讨论】:
标签: c# asp.net-core oauth-2.0 identityserver4