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

Commit

Permalink
Updated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
wndhydrnt committed Dec 13, 2013
1 parent d1d2079 commit c46e684
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
6 changes: 4 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ While the basic implementations work already pretty well, some types of
authorization Grants
`defined in the RFC <http://tools.ietf.org/html/rfc6749#section-1.3>`_ are
still missing.
Also some features like `Refreh Tokens <http://tools.ietf.org/html/rfc6749#section-1.5>`_
have not been implemented yet.

Installation
************
Expand Down Expand Up @@ -84,6 +82,10 @@ Example Authorization server::
# Add Grants you want to support
auth_controller.add_grant(oauth2.grant.AuthorizationCodeGrant())
auth_controller.add_grant(oauth2.grant.ImplicitGrant())
# Add refresh token capability and set expiration time of access tokens
# to 30 days
auth_controller.add_grant(oauth2.grant.RefreshToken(expires_in=2592000))

# Wrap the controller with the Wsgi adapter
app = oauth2.web.Wsgi(server=auth_controller)
Expand Down
3 changes: 3 additions & 0 deletions docs/grant.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ Grant classes

.. autoclass:: ResourceOwnerGrant
:show-inheritance:

.. autoclass:: RefreshToken
:show-inheritance:
4 changes: 4 additions & 0 deletions oauth2/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ def render_auth_page(self, request, response, environ, scopes):
# Add Grants you want to support
auth_controller.add_grant(oauth2.grant.AuthorizationCodeGrant())
auth_controller.add_grant(oauth2.grant.ImplicitGrant())
# Add refresh token capability and set expiration time of access tokens
# to 30 days
auth_controller.add_grant(oauth2.grant.RefreshToken(expires_in=2592000))
# Wrap the controller with the Wsgi adapter
app = oauth2.web.Wsgi(server=auth_controller)
Expand Down
11 changes: 10 additions & 1 deletion oauth2/grant.py
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,16 @@ class RefreshToken(GrantHandlerFactory, ScopeGrant):
Handles requests for refresk tokens as defined in
http://tools.ietf.org/html/rfc6749#section-6.
Dispatches to :class:`RefreshTokenHandler` for the actual processing.
Adding a Refresh Token to the :class:`oauth2.AuthorizationController` like
this::
auth_controller = AuthorizationController()
auth_controller.add_grant_type(RefreshToken(expires_in=600))
will cause :class:`oauth2.grant.AuthorizationCodeGrant` and
:class:`oauth2.grant.ResourceOwnerGrant` to include a refresh token and
expiration in the response.
"""

grant_type = "refresh_token"
Expand Down

0 comments on commit c46e684

Please sign in to comment.