首页 新闻 搜索 专区 学院

IdentityServer 的 Selector 在哪个 nuget 包

0
悬赏园豆:30 [已解决问题] 解决于 2021-02-05 15:47

参考 IdentityServer 的帮助文档 Protecting APIs ,在一个 .NERT 5.0 项目的 Startup 中添加了下面的代码

services.AddAuthentication("token")

    // JWT tokens
    .AddJwtBearer("token", options =>
    {
        options.Authority = Constants.Authority;
        options.Audience = "resource1";

        options.TokenValidationParameters.ValidTypes = new[] { "at+jwt" };

        // if token does not contain a dot, it is a reference token
        options.ForwardDefaultSelector = Selector.ForwardReferenceToken("introspection");
    })

    // reference tokens
    .AddOAuth2Introspection("introspection", options =>
    {
        options.Authority = Constants.Authority;

        options.ClientId = "resource1";
        options.ClientSecret = "secret";
    });

提示下面的错误

The name 'Selector' does not exist in the current context

请问需要安装哪个 nuget 包?

dudu的主页 dudu | 高人七级 | 园豆:36371
提问于:2021-02-05 15:18
< >
分享
最佳答案
0

The Selector.ForwardReferenceToken is a little helper that I packaged up in the IdentityModel.AspNetCore.AccessTokenValidation nuget package.

https://leastprivilege.com/2020/07/06/flexible-access-token-validation-in-asp-net-core/

收获园豆:30
czd890 | 专家六级 |园豆:12614 | 2021-02-05 15:42

就是这个 IdentityModel.AspNetCore.AccessTokenValidation,是一个 prerelease 版的包,难怪一开始没找到

dudu | 园豆:36371 (高人七级) | 2021-02-05 15:46
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册