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

Commit

Permalink
Merge pull request #35 from wndhydrnt/fix_readme_example
Browse files Browse the repository at this point in the history
Fix error in example code of README
  • Loading branch information
wndhydrnt committed Feb 11, 2015
2 parents 251690a + ad7ca6f commit c96228a
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ Example Authorization server
# Create a SiteAdapter to interact with the user.
# This can be used to display confirmation dialogs and the like.
class ExampleSiteAdapter(oauth2.web.SiteAdapter):
class ExampleSiteAdapter(oauth2.web.AuthorizationCodeGrantSiteAdapter,
oauth2.web.ImplicitGrantSiteAdapter):
def authenticate(self, request, environ, scopes):
# Check if the user has granted access
if request.post_param("confirm") == "confirm":
Expand Down Expand Up @@ -80,13 +81,14 @@ Example Authorization server
access_token_store=token_store,
auth_code_store=token_store,
client_store=client_store,
site_adapter=ExampleSiteAdapter(),
token_generator=oauth2.tokengenerator.Uuid4()
)
site_adapter = ExampleSiteAdapter()
# Add Grants you want to support
auth_controller.add_grant(oauth2.grant.AuthorizationCodeGrant())
auth_controller.add_grant(oauth2.grant.ImplicitGrant())
auth_controller.add_grant(oauth2.grant.AuthorizationCodeGrant(site_adapter=site_adapter))
auth_controller.add_grant(oauth2.grant.ImplicitGrant(site_adapter=site_adapter))
# Add refresh token capability and set expiration time of access tokens
# to 30 days
Expand All @@ -99,6 +101,10 @@ Example Authorization server
httpd = make_server('', 8080, app)
httpd.serve_forever()
This example only shows how to instantiate the server.
It is not a working example as a client app is missing. Take a look at the
`examples <examples/>`_ directory.

Supported storage backends
**************************

Expand Down

0 comments on commit c96228a

Please sign in to comment.