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: - request – An instance of oauth2.web.Request.
- response – An instance of oauth2.web.Response.
- environ – Environment variables of the request.
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.
- Request.get_param(name, default=None)[source]¶
Returns a param of a GET request identified by its name.