Public Member Functions | Private Member Functions
tornado.auth.OAuthMixin Class Reference
Inheritance diagram for tornado.auth.OAuthMixin:
Inheritance graph
[legend]

List of all members.

Public Member Functions

def authorize_redirect
def get_auth_http_client
def get_authenticated_user

Private Member Functions

def _oauth_access_token_url
def _oauth_consumer_token
def _oauth_get_user
def _oauth_get_user_future
def _oauth_request_parameters
def _oauth_request_token_url
def _on_access_token
def _on_oauth_get_user
def _on_request_token

Detailed Description

Abstract implementation of OAuth 1.0 and 1.0a.

See `TwitterMixin` and `FriendFeedMixin` below for example implementations,
or `GoogleMixin` for an OAuth/OpenID hybrid.

Class attributes:

* ``_OAUTH_AUTHORIZE_URL``: The service's OAuth authorization url.
* ``_OAUTH_ACCESS_TOKEN_URL``: The service's OAuth access token url.
* ``_OAUTH_VERSION``: May be either "1.0" or "1.0a".
* ``_OAUTH_NO_CALLBACKS``: Set this to True if the service requires
  advance registration of callbacks.

Subclasses must also override the `_oauth_get_user_future` and
`_oauth_consumer_token` methods.

Definition at line 312 of file auth.py.


Member Function Documentation

def tornado.auth.OAuthMixin._oauth_access_token_url (   self,
  request_token 
) [private]

Definition at line 454 of file auth.py.

Subclasses must override this to return their OAuth consumer keys.

The return value should be a `dict` with keys ``key`` and ``secret``.

Reimplemented in tornado.auth.GoogleMixin, tornado.auth.FriendFeedMixin, and tornado.auth.TwitterMixin.

Definition at line 487 of file auth.py.

def tornado.auth.OAuthMixin._oauth_get_user (   self,
  access_token,
  callback 
) [private]

Definition at line 514 of file auth.py.

def tornado.auth.OAuthMixin._oauth_get_user_future (   self,
  access_token,
  callback 
) [private]
Subclasses must override this to get basic information about the
user.

Should return a `.Future` whose result is a dictionary
containing information about the user, which may have been
retrieved by using ``access_token`` to make a request to the
service.

The access token will be added to the returned dictionary to make
the result of `get_authenticated_user`.

For backwards compatibility, the callback-based ``_oauth_get_user``
method is also supported.

Reimplemented in tornado.auth.FriendFeedMixin.

Definition at line 495 of file auth.py.

def tornado.auth.OAuthMixin._oauth_request_parameters (   self,
  url,
  access_token,
  parameters = {},
  method = "GET" 
) [private]
Returns the OAuth parameters as a dict for the given request.

parameters should include all POST arguments and query string arguments
that will be sent with the request.

Definition at line 528 of file auth.py.

def tornado.auth.OAuthMixin._oauth_request_token_url (   self,
  callback_uri = None,
  extra_params = None 
) [private]

Definition at line 410 of file auth.py.

def tornado.auth.OAuthMixin._on_access_token (   self,
  future,
  response 
) [private]

Definition at line 478 of file auth.py.

def tornado.auth.OAuthMixin._on_oauth_get_user (   self,
  access_token,
  future,
  user_future 
) [private]

Definition at line 517 of file auth.py.

def tornado.auth.OAuthMixin._on_request_token (   self,
  authorize_url,
  callback_uri,
  callback,
  response 
) [private]

Definition at line 435 of file auth.py.

def tornado.auth.OAuthMixin.authorize_redirect (   self,
  callback_uri = None,
  extra_params = None,
  http_client = None,
  callback = None 
)
Redirects the user to obtain OAuth authorization for this service.

The ``callback_uri`` may be omitted if you have previously
registered a callback URI with the third-party service.  For
some sevices (including Friendfeed), you must use a
previously-registered callback URI and cannot specify a
callback via this method.

This method sets a cookie called ``_oauth_request_token`` which is
subsequently used (and cleared) in `get_authenticated_user` for
security purposes.

Note that this method is asynchronous, although it calls
`.RequestHandler.finish` for you so it may not be necessary
to pass a callback or use the `.Future` it returns.  However,
if this method is called from a function decorated with
`.gen.coroutine`, you must call it with ``yield`` to keep the
response from being closed prematurely.

.. versionchanged:: 3.1
   Now returns a `.Future` and takes an optional callback, for
   compatibility with `.gen.coroutine`.

Definition at line 330 of file auth.py.

Returns the `.AsyncHTTPClient` instance to be used for auth requests.

May be overridden by subclasses to use an HTTP client other than
the default.

Definition at line 556 of file auth.py.

def tornado.auth.OAuthMixin.get_authenticated_user (   self,
  callback,
  http_client = None 
)
Gets the OAuth authorized user and access token.

This method should be called from the handler for your
OAuth callback URL to complete the registration process. We run the
callback with the authenticated user dictionary.  This dictionary
will contain an ``access_key`` which can be used to make authorized
requests to this service on behalf of the user.  The dictionary will
also contain other fields such as ``name``, depending on the service
used.

Definition at line 377 of file auth.py.


The documentation for this class was generated from the following file:


rosbridge_server
Author(s): Jonathan Mace
autogenerated on Thu Aug 27 2015 14:50:40