identity 1.0 documentation

OAuth Token Introspection

«  OAuth Dynamic Client Registration Protocol   ::   Contents   ::   JSON Metadata for OAuth Responses  »

OAuth Token Introspection

Abstract

This specification defines a method for a client or protected resource to query an OAuth authorization server to determine meta-information about an OAuth token.

(draft 04, http://tools.ietf.org/html/draft-richer-oauth-introspection-04)

1. Introduction

In OAuth, the contents of tokens are opaque to clients.

This means that the client does not need to know anything about the content or structure of the token itself, if there is any.

However, there is still a large amount of metadata that may be attached to a token, such as its current validity, approved scopes, and extra information about the authentication context in which the token was issued.

Note

  • トークンは現在有効か?
  • 承認されたスコープは?
  • 認証コンテキスト詳細は?

These pieces of information are often vital to Protected Resources making authorization decisions based on the tokens being presented. Since OAuth2 defines no direct relationship between the Authorization Server and the Protected Resource, only that they must have an agreement on the tokens themselves, there have been many different approaches to bridging this gap.

This specification defines an Introspection Endpoint that allows the holder of a token to query the Authorization Server to discover the set of metadata for a token.

A Protected Resource may use the mechanism described in this draft to query the Introspection Endpoint in a particular authorization decision context and ascertain the relevant metadata about the token in order to make this authorization decision appropriately.

( http://tools.ietf.org/html/draft-richer-oauth-introspection-04#section-1 )

Note

  • draft 04まで同じ

2. Introspection Endpoint

The Introspection Endpoint is an OAuth 2 Endpoint that responds to HTTP POST requests ( and optionally HTTP GET requests) from token holders, particularly including Resource Servers and Clients.

Note

  • OAuth endpoints ということは access_token が必要ということ
  • draft 04 になって、POSTを標準とする事になった

The endpoint takes a single parameter representing the token (and optionally further authentication) and returns a JSON document representing the meta information surrounding the token.

Note

  • 入力 “token”
  • 出力 “メタ情報JSON”

The endpoint MUST be protected by TLS or equivalent.

( http://tools.ietf.org/html/draft-richer-oauth-introspection-04#section-2 )

2.1. Introspection Request

token

REQUIRED.

The string value of the token.

resource_id

OPTIONAL.

A service-specific string identifying the resource that the client doing the introspection is asking about.

token_type_hint

OPTIONAL.

A hint about the type of the token submitted for revocation.

Clients MAY pass this parameter in order to help the authorization server to optimize the token lookup.

If the server is unable to locate the token using the given hint, it MUST extend its search accross all of its supported token types.

An authorization server MAY ignore this parameter, particularly if it is able to detect the token type automatically.

Values for this field are defined in OAuth Token Revocation [Revocation]

Note

  • draft 04 で token_type_hint が追加
  • Authz Serverが問い合わせのトークンの検索を効率的に行えるようになる

The endpoint MAY allow other parameters to provide context to the query.

For instance, an authorization service may need to know the IP address of the Client in order to determine the appropriateness of the token being presented.

The endpoint SHOULD also require some form of authentication to access this endpoint, such as the Client Authentication as described in OAuth 2 Core Specification [RFC6749] or a separate OAuth 2.0 Access Token.

The methods of managing and validating these authentication credentials are out of scope of this specification.

Note

  • トークン必要(あるいはクレデンシャル)
  • アウトオブスコープ

( http://tools.ietf.org/html/draft-richer-oauth-introspection-04#section-2.1 )

2.2. Introspection Response

The server responds with a JSON object [RFC4627] in “application/json” format with the following top-level members.

Specific implementations MAY extend this structure with their own service-specific pieces of information.

valid

REQUIRED.

Boolean indicator of whether or not the presented token is valid.

exp

OPTIONAL.

Integer timestamp, measured in the number of seconds since January 1 1970 UTC, indicating when this token will expire.

iat

OPTIONAL.

Integer timestamp, measured in the number of seconds since January 1 1970 UTC, indicating when this token was originally issued.

scope

OPTIONAL.

A space-separated list of strings representing the scopes associated with this token, in the format described in Section 3.3 of OAuth 2.0 [RFC6749].

client_id

OPTIONAL.

Client Identifier for the OAuth Client that requested this token.

sub

OPTIONAL.

Local identifier of the Resource Owner who authorized this token.

aud

OPTIONAL.

Service-specific string identifier or list of string identifiers representing the intended audience for this token.

Note

  • draft 04:複数のaudの識別子がありえるということ
token_type

OPTIONAL.

Type of the token as defined in OAuth 2.0 section 5.1.

( http://tools.ietf.org/html/draft-richer-oauth-introspection-04#section-2.2)

Note

  • draft04

    • パラメータ名称変更(exp,iat,sub,aud)
    • scope がスペース区切りの文字列に(OAuth互換)
    • token_type 追加

2.3. Non-normative Example

For example, a Protected Resource accepts a request from a Client carrying an OAuth2 Bearer Token.

In order to know how and whether to serve the request, the Protected Resource then makes the following request to the Introspection Endpoint of the Authorization Server.

The Protected Resource is here authenticating with its own Client ID and Client Secret as per OAuth2 [RFC6749] Section 2.3.1.

Following is a non-normative example request (with line wraps for display purposes only):

POST /register HTTP/1.1
Accept: application/x-www-form-urlencoded
Host: server.example.com
Authorization: Basic czZCaGRSa3F0Mzo3RmpmcDBaQnIxS3REUmJuZlZkbUl3

token=X3241Affw.4233-99JXJ

The Authorization Server validates the client credentials and looks up the information in the token. If the token is valid, it returns the following JSON document.

Following is a non-normative example valid token response (with line wraps for display purposes only):

HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-store

{
 "valid": true,
 "client_id":"s6BhdRkqt3",
 "scope": "read write dolphin,
 "sub": "2309fj32kl",
 "aud": "http://example.org/protected-resource/*"
}

If the token presented is not currently active (but the authentication presented is valid), it returns the following JSON document.

Following is a non-normative example response to an inactive or invalid token (with line wraps for display purposes only):

HTTP/1.1 200 OK
Content-Type: application/json
Cache-Control: no-store

{
 "valid": false
}

If the client credentials are invalid or there is another error, the Authorization Server responds with an HTTP 400 (Bad Request) as described in OAuth 2.0 section 5.2 [RFC6749].

( http://tools.ietf.org/html/draft-richer-oauth-introspection-04#section-2.3 )

3. IANA Considerations

This document makes no request of IANA.

4. Security Considerations

If left unprotected and un-throttled, the Introspection Endpoint could present a means for an attacker to poll a series of possible token values, fishing for a valid token.

Therefore, the Authorization Server SHOULD issue special client credentials to any protected resources or clients that need to access the introspection endpoint.

These credentials may be used directly at the endpoint, or they may be exchanged for an OAuth2 Access token scoped specifically for the Introspection Endpoint.

Since the introspection endpoint takes in OAuth 2 tokens as parameters, it MUST be protected by TLS or equivalent. A server MAY require an HTTP POST method only to the endpoint.

( http://tools.ietf.org/html/draft-richer-oauth-introspection-04#section-4 )

5. Acknowledgements

Thanks to the OAuth Working Group and the UMA Working Group for feedback.

6. Normative References

[RFC2119]
Bradner, S., “Key words for use in RFCs to Indicate Requirement Levels”, BCP 14, RFC 2119, March 1997.
[RFC4627]
Crockford, D., “The application/json Media Type for JavaScript Object Notation (JSON)”, RFC 4627, July 2006.
[RFC6749]
Hardt, D., “The OAuth 2.0 Authorization Framework”, RFC 6749, October 2012.
[RFC6750]
Jones, M. and D. Hardt, “The OAuth 2.0 Authorization Framework: Bearer Token Usage”, RFC 6750, October 2012.
[Revocation]
Lodderstedt, T., “OAuth Token Revocation”, April 2013.

«  OAuth Dynamic Client Registration Protocol   ::   Contents   ::   JSON Metadata for OAuth Responses  »