Skip to content

Commit f743e23

Browse files
committed
Token Introspection docs (#257)
Added a new doc page related to Token Introspection Endpoint. The documentation includes some introduction with links to the related RFCs and examples.
1 parent 02a17e1 commit f743e23

File tree

2 files changed

+58
-0
lines changed

2 files changed

+58
-0
lines changed

docs/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ Contents:
3535
sections/oauth2
3636
sections/accesstokens
3737
sections/sessionmanagement
38+
sections/tokenintrospection
3839
sections/settings
3940
sections/signals
4041
sections/examples
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
.. _tokenintrospection:
2+
3+
Token Introspection
4+
##################
5+
6+
The `OAuth 2.0 Authorization Framework <https://tools.ietf.org/html/rfc6749>`_ extends its scope with many other speficications. One of these is the `OAuth 2.0 Token Introspection (RFC 7662) <https://tools.ietf.org/html/rfc7662>`_ which defines a protocol that allows authorized protected resources to query the authorization server to determine the set of metadata for a given token that was presented to them by an OAuth 2.0 client.
7+
8+
Client Setup
9+
====
10+
In order to enable this feature, some configurations must be performed in the ``Client``.
11+
12+
- The scope key:``token_introspection`` must be added to the client's scope.
13+
14+
If ``OIDC_INTROSPECTION_VALIDATE_AUDIENCE_SCOPE`` is set to ``True`` then:
15+
16+
- The ``client_id`` must be added to the client's scope.
17+
18+
Introspection Endpoint
19+
====
20+
The introspection endpoint ``(/introspect)`` is an OAuth 2.0 endpoint that takes a parameter representing an OAuth 2.0 token and returns a JSON document representing the meta information surrounding the token.
21+
22+
The introspection endpoint its called using an HTTP POST request with parameters sent as *"application/x-www-form-urlencoded"* and **Basic authentication** (``base64(client_id:client_secret``).
23+
24+
Parameters:
25+
26+
* ``token``
27+
REQUIRED. The string value of an ``access_token`` previously issued.
28+
29+
Example request::
30+
31+
curl -X POST \
32+
http://localhost:8000/introspect \
33+
-H 'Authorization: Basic NDgwNTQ2OmIxOGIyODVmY2E5N2Fm' \
34+
-H 'Content-Type: application/x-www-form-urlencoded' \
35+
-d token=6dd4b859706944848183d26f2fcb99c6
36+
37+
Example Response::
38+
39+
{
40+
"aud": "480546",
41+
"sub": "1",
42+
"exp": 1538971676,
43+
"iat": 1538971076,
44+
"iss": "http://localhost:8000",
45+
"active": true,
46+
"client_id": "480546"
47+
}
48+
49+
Introspection Endpoint Errors
50+
====
51+
In case of error, the Introspection Endpoint will return a JSON document with the key ``active: false``
52+
53+
Example Error Response::
54+
55+
{
56+
"active": "false"
57+
}

0 commit comments

Comments
 (0)