IdentityServer3 - 客户和秘密
IdentityServer3 - Client and Secret
我正在学习一些教程,看看我是否可以使用 IdentityServer3 issue/handle 令牌来授权访问某些 Web Api 端点。
我不太理解的概念之一是 Client
和 Secret
。在以前的项目中使用 OAuth 时,我从来不需要在 header 中传递 client
或 secret
值。我只通过了 grant_type
、username
和 password
。然而 IdentityServer 似乎期望 client
和 secret
以及 grant_type
、username
和 password
.
为什么需要 client
?不管客户端的类型如何,IdentityServer 不应该只传回不记名令牌吗?另外,secret
参数的用途是什么?这是否用于创建 JWT 令牌的签名?
client_id
和 client_secret
是 part of the OAuth spec,不是特定于 Identity Server 的实现。它们是客户端注册的一部分,我喜欢将其视为访问控制列表,检查请求方是否有权使用请求的流程和范围接收访问令牌。
未注册的客户端是 supported in the OAuth 规范,但我还没有遇到过。
从它的声音来看,您一直在使用 ResourceOwner 流程,它需要 grant_type
个 password
、client_id
、client_secret
、多个 scope
的,username
和 password
.
client_id
和 client_secret
也可以使用 Basic
方案进行 base64 编码并在 Authorization
header 中发送。
秘密不用于JWT验证,它仅用于验证传入的客户端。
我正在学习一些教程,看看我是否可以使用 IdentityServer3 issue/handle 令牌来授权访问某些 Web Api 端点。
我不太理解的概念之一是 Client
和 Secret
。在以前的项目中使用 OAuth 时,我从来不需要在 header 中传递 client
或 secret
值。我只通过了 grant_type
、username
和 password
。然而 IdentityServer 似乎期望 client
和 secret
以及 grant_type
、username
和 password
.
为什么需要 client
?不管客户端的类型如何,IdentityServer 不应该只传回不记名令牌吗?另外,secret
参数的用途是什么?这是否用于创建 JWT 令牌的签名?
client_id
和 client_secret
是 part of the OAuth spec,不是特定于 Identity Server 的实现。它们是客户端注册的一部分,我喜欢将其视为访问控制列表,检查请求方是否有权使用请求的流程和范围接收访问令牌。
未注册的客户端是 supported in the OAuth 规范,但我还没有遇到过。
从它的声音来看,您一直在使用 ResourceOwner 流程,它需要 grant_type
个 password
、client_id
、client_secret
、多个 scope
的,username
和 password
.
client_id
和 client_secret
也可以使用 Basic
方案进行 base64 编码并在 Authorization
header 中发送。
秘密不用于JWT验证,它仅用于验证传入的客户端。