IdentityServer3 - 客户和秘密

IdentityServer3 - Client and Secret

我正在学习一些教程,看看我是否可以使用 IdentityServer3 issue/handle 令牌来授权访问某些 Web Api 端点。

我不太理解的概念之一是 ClientSecret。在以前的项目中使用 OAuth 时,我从来不需要在 header 中传递 clientsecret 值。我只通过了 grant_typeusernamepassword。然而 IdentityServer 似乎期望 clientsecret 以及 grant_typeusernamepassword.

为什么需要 client?不管客户端的类型如何,IdentityServer 不应该只传回不记名令牌吗?另外,secret 参数的用途是什么?这是否用于创建 JWT 令牌的签名?

client_idclient_secretpart of the OAuth spec,不是特定于 Identity Server 的实现。它们是客户端注册的一部分,我喜欢将其视为访问控制列表,检查请求方是否有权使用请求的流程和范围接收访问令牌。

未注册的客户端是 supported in the OAuth 规范,但我还没有遇到过。

从它的声音来看,您一直在使用 ResourceOwner 流程​​,它需要 grant_typepasswordclient_idclient_secret、多个 scope的,usernamepassword.

client_idclient_secret 也可以使用 Basic 方案进行 base64 编码并在 Authorization header 中发送。

秘密不用于JWT验证,它仅用于验证传入的客户端。