Ven*_*idu 4 jwt identityserver3
我的应用程序中有以下代码,比如 WebApp1:
app.UseIdentityServerBearerTokenAuthentication(new IdentityServerBearerTokenAuthenticationOptions
{
Authority = "IdentityServerPath",
RequiredScopes = new[] { "write", "role", "all_claims" },
ValidationMode = ValidationMode.Local,
});
Run Code Online (Sandbox Code Playgroud)
调用方/客户端应用程序将 JWT 令牌传递给 WebApp1。WebApp1 如何知道 JWT 令牌有效?WebApp1 需要知道 JWT 令牌的公钥吗?如果不是,WebApp1如何验证JWT的签名?请注意,我使用 ValidationMode 作为本地,因此 WebApp1 不会联系 IdentityServer 来验证 JWT 令牌。
对于“本地”选项,UseIdentityServerBearerTokenAuthentication使用发现文档(https://openid.net/specs/openid-connect-discovery-1_0.html)动态下载验证 JWT 所需的签名材料。
“验证端点”的另一个选项使用自定义令牌验证端点(https://identityserver.github.io/Documentation/docsv2/endpoints/accessTokenValidation.html),或者如果配置了客户端 ID 和密钥,则标准OAuth2 自省 ( https://tools.ietf.org/html/rfc7662 ) 端点用于验证令牌 ( https://identityserver.github.io/Documentation/docsv2/endpoints/introspection.html )。
“两者”的最后一个选项将基于对呈现给 Web API 的传入访问令牌的一些启发式方法来动态确定上述两种方法中的哪一种。
| 归档时间: |
|
| 查看次数: |
5868 次 |
| 最近记录: |