Skip to content
This repository was archived by the owner on Jun 29, 2019. It is now read-only.

Commit c46e684

Browse files
committed
Updated docs
1 parent d1d2079 commit c46e684

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

README.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ While the basic implementations work already pretty well, some types of
1717
authorization Grants
1818
`defined in the RFC <http://tools.ietf.org/html/rfc6749#section-1.3>`_ are
1919
still missing.
20-
Also some features like `Refreh Tokens <http://tools.ietf.org/html/rfc6749#section-1.5>`_
21-
have not been implemented yet.
2220

2321
Installation
2422
************
@@ -84,6 +82,10 @@ Example Authorization server::
8482
# Add Grants you want to support
8583
auth_controller.add_grant(oauth2.grant.AuthorizationCodeGrant())
8684
auth_controller.add_grant(oauth2.grant.ImplicitGrant())
85+
86+
# Add refresh token capability and set expiration time of access tokens
87+
# to 30 days
88+
auth_controller.add_grant(oauth2.grant.RefreshToken(expires_in=2592000))
8789

8890
# Wrap the controller with the Wsgi adapter
8991
app = oauth2.web.Wsgi(server=auth_controller)

docs/grant.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ Grant classes
2525

2626
.. autoclass:: ResourceOwnerGrant
2727
:show-inheritance:
28+
29+
.. autoclass:: RefreshToken
30+
:show-inheritance:

oauth2/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ def render_auth_page(self, request, response, environ, scopes):
6363
# Add Grants you want to support
6464
auth_controller.add_grant(oauth2.grant.AuthorizationCodeGrant())
6565
auth_controller.add_grant(oauth2.grant.ImplicitGrant())
66+
67+
# Add refresh token capability and set expiration time of access tokens
68+
# to 30 days
69+
auth_controller.add_grant(oauth2.grant.RefreshToken(expires_in=2592000))
6670
6771
# Wrap the controller with the Wsgi adapter
6872
app = oauth2.web.Wsgi(server=auth_controller)

oauth2/grant.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -669,7 +669,16 @@ class RefreshToken(GrantHandlerFactory, ScopeGrant):
669669
Handles requests for refresk tokens as defined in
670670
http://tools.ietf.org/html/rfc6749#section-6.
671671
672-
Dispatches to :class:`RefreshTokenHandler` for the actual processing.
672+
Adding a Refresh Token to the :class:`oauth2.AuthorizationController` like
673+
this::
674+
675+
auth_controller = AuthorizationController()
676+
677+
auth_controller.add_grant_type(RefreshToken(expires_in=600))
678+
679+
will cause :class:`oauth2.grant.AuthorizationCodeGrant` and
680+
:class:`oauth2.grant.ResourceOwnerGrant` to include a refresh token and
681+
expiration in the response.
673682
"""
674683

675684
grant_type = "refresh_token"

0 commit comments

Comments
 (0)