From c46e6849b018e2c41f6411d60db3394cb1b2ca41 Mon Sep 17 00:00:00 2001 From: wndhydrnt Date: Fri, 13 Dec 2013 18:15:21 +0100 Subject: [PATCH] Updated docs --- README.rst | 6 ++++-- docs/grant.rst | 3 +++ oauth2/__init__.py | 4 ++++ oauth2/grant.py | 11 ++++++++++- 4 files changed, 21 insertions(+), 3 deletions(-) diff --git a/README.rst b/README.rst index d6e8413..97de844 100644 --- a/README.rst +++ b/README.rst @@ -17,8 +17,6 @@ While the basic implementations work already pretty well, some types of authorization Grants `defined in the RFC `_ are still missing. -Also some features like `Refreh Tokens `_ -have not been implemented yet. Installation ************ @@ -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) diff --git a/docs/grant.rst b/docs/grant.rst index 17eff58..f74de5a 100644 --- a/docs/grant.rst +++ b/docs/grant.rst @@ -25,3 +25,6 @@ Grant classes .. autoclass:: ResourceOwnerGrant :show-inheritance: + +.. autoclass:: RefreshToken + :show-inheritance: diff --git a/oauth2/__init__.py b/oauth2/__init__.py index 72168be..9341431 100644 --- a/oauth2/__init__.py +++ b/oauth2/__init__.py @@ -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) diff --git a/oauth2/grant.py b/oauth2/grant.py index f8ba853..eff7706 100644 --- a/oauth2/grant.py +++ b/oauth2/grant.py @@ -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"