oauth2.web — Interaction over HTTP

Classes for handling a HTTP request/response flow.

class oauth2.web.SiteAdapter[source]

Interact with a user.

Display HTML or redirect the user agent to another page of your website where she can do something before being returned to the OAuth 2.0 server.

SiteAdapter.authenticate(request, environ, scopes)[source]

Authenticates a user and checks if she has authorized access.

Parameters:
  • request – An instance of oauth2.web.Request.
  • environ – Environment variables of the request.
  • scopes – A list of strings with each string being one requested scope.
Returns:

A dict containing arbitrary data that will be passed to the current storage adapter and saved with auth code and access token.

Raises :

oauth2.error.UserNotAuthenticated if the user could not be authenticated.

SiteAdapter.render_auth_page(request, response, environ)[source]

Defines how to display a confirmation page to the user.

Parameters:
Returns:

The response passed in as a parameter. It can contain HTML or issue a redirect.

SiteAdapter.user_has_denied_access(request)[source]

Checks if the user has denied access. This will lead to python-oauth2 returning a “acess_denied” response to the requesting client app.

Parameters:request – An instance of oauth2.web.Request.
Returns:Return True if the user has denied access.
class oauth2.web.Request(env)[source]

Contains data of the current HTTP request.

Request.get_param(name, default=None)[source]

Returns a param of a GET request identified by its name.

Request.post_param(name, default=None)[source]

Returns a param of a POST request identified by its name.

class oauth2.web.Response[source]

Contains data returned to the requesting user agent.

Read the Docs v: v0.4.0
Versions
latest
v0.4.0
Downloads
On Read the Docs
Project Home
Builds

Free document hosting provided by Read the Docs.