7.1. 访问令牌类型(7.1. Access Token Types)
7.1. 访问令牌类型
访问令牌的类型给客户端提供了成功使用该访问令牌(和类型指定的属性)发起受保护资源请求所需的信息 若客户端不理解令牌类型,则不能使用该访问令牌。
例如,RFC6750定义的“bearer”令牌类型简单的在请求中包含访问令牌字符串来使用:
GET /resource/1 HTTP/1.1 Host: example.com Authorization: Bearer F_9.B5f-4.1JqM
而[OAuth-HTTP-MAC]定义的“mac”令牌类型通过与许可类型一起颁发用于对HTTP请求中某些部分签名的消息认证码(MAC)的密钥来使用。
GET /resource/1 HTTP/1.1 Host: example.com Authorization: MAC id="h480djs93hd8",nonce="274312:dj83hs9s",mac="kDZvddkndxvhGRXZhvuDjEWhGeE="
提供上面的例子仅作说明用途。建议开发人员在使用前查阅RFC6750和[OAuth-HTTP-MAC]规范。
每一种访问令牌类型的定义指定与“access_token”响应参数一起发送到客户端的额外属性。它还定义了HTTP验证方法当请求受保护资源时用于包含访问令牌。
7.1. Access Token Types
The access token type provides the client with the information
required to successfully utilize the access token to make a protected
resource request (along with type-specific attributes). The client
MUST NOT use an access token if it does not understand the token
type.
For example, the "bearer" token type defined in [RFC6750] is utilized
by simply including the access token string in the request:
GET /resource/1 HTTP/1.1
Host: example.com
Authorization: Bearer mF_9.B5f-4.1JqM
while the "mac" token type defined in [OAuth-HTTP-MAC] is utilized by
issuing a Message Authentication Code (MAC) key together with the
access token that is used to sign certain components of the HTTP
requests:
GET /resource/1 HTTP/1.1
Host: example.com
Authorization: MAC id="h480djs93hd8",
nonce="274312:dj83hs9s",
mac="kDZvddkndxvhGRXZhvuDjEWhGeE="
The above examples are provided for illustration purposes only.
Developers are advised to consult the [RFC6750] and [OAuth-HTTP-MAC]
specifications before use.
Each access token type definition specifies the additional attributes
(if any) sent to the client together with the "access_token" response
parameter. It also defines the HTTP authentication method used to
include the access token when making a protected resource request.
No Comments