我对MVC / Webforms场景中引用tokens和内省 endpoints 的用例感到困惑 .

我的基本问题是为什么内省 endpoints 只设置为允许来自ApiResource凭证(api1 / apisecret)的身份验证请求而不允许客户端凭据?我可以使用ApiResource凭据下面的代码,我只是未经授权使用客户端凭据 . 我认为这是设计的 .

我想让我们的系统管理员能够撤销令牌并强制注销用户 . 我的计划是使用CookieAuthenticationProvider的OnValidateIdentity定期验证引用令牌,并在需要时强制注销 . 我认为我可以使用短暂的自包含JWT令牌和刷新令牌获得类似的功能,但是喜欢使用引用令牌的简单性 . 我显然可以在同一个应用程序中使用两组凭据,一个用于客户端,一个用于ApiResource,但接口更直观,可以使用/管理一组凭据,即客户端 . 我不应该为服务器端可信应用程序使用引用令牌吗?

我的客户设置如下 .

AllowedGrantTypes = GrantTypes.HybridAndClientCredentials,
    AccessTokenType = AccessTokenType.Reference,

以下是我的研究中的一些注释 .

以下是关于Introspection Endpoint的文档 - http://docs.identityserver.io/en/release/endpoints/introspection.html

这是Dominick Baier关于参考标记的帖子 - https://leastprivilege.com/2015/11/25/reference-tokens-and-introspection/

这是我正在使用的IntrospectionClient调用的示例 . https://github.com/IdentityServer/IdentityServer4.Samples/blob/release/Clients/src/ConsoleIntrospectionClient/Program.cs

这是内省的规范,您可以看到它并不表示所需的身份验证类型 . - https://tools.ietf.org/html/rfc7662

为了防止令牌扫描攻击, endpoints 还必须要求某种形式的授权才能访问此 endpoints ,例如OAuth 2.0 [RFC6749]中描述的客户端身份验证或单独的OAuth 2.0访问令牌,例如OAuth 2.0承载中描述的承载令牌令牌使用[RFC6750] . 管理和验证这些身份验证凭据的方法超出了本规范的范围 .

这是带有秘密的ApiResource的示例 .

// simple version with ctor
            new ApiResource("api1", "Some API 1")
            {
                // this is needed for introspection when using reference tokens
                ApiSecrets = { new Secret("apisecret".Sha256()) }
            },

以下是ConsoleIntrospectionClient客户端的示例客户端 .

new Client
                {
                    ClientId = "roclient.reference",
                    ClientSecrets = 
                    {
                        new Secret("secret".Sha256())
                    },

                    AllowedGrantTypes = GrantTypes.ResourceOwnerPassword,
                    AllowedScopes = { "api1", "api2.read_only" },

                    AccessTokenType = AccessTokenType.Reference
                },