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

List of all members.

Public Member Functions

def authorize_redirect
def get_authenticated_user

Private Member Functions

def _oauth_consumer_token
def _oauth_get_user_future

Static Private Attributes

string _OAUTH_ACCESS_TOKEN_URL = "https://www.google.com/accounts/OAuthGetAccessToken"
string _OPENID_ENDPOINT = "https://www.google.com/accounts/o8/ud"

Detailed Description

Google Open ID / OAuth authentication.

.. deprecated:: 4.0
   New applications should use `GoogleOAuth2Mixin`
   below instead of this class. As of May 19, 2014, Google has stopped
   supporting registration-free authentication.

No application registration is necessary to use Google for
authentication or to access Google resources on behalf of a user.

Google implements both OpenID and OAuth in a hybrid mode.  If you
just need the user's identity, use
`~OpenIdMixin.authenticate_redirect`.  If you need to make
requests to Google on behalf of the user, use
`authorize_redirect`.  On return, parse the response with
`~OpenIdMixin.get_authenticated_user`. We send a dict containing
the values for the user, including ``email``, ``name``, and
``locale``.

Example usage::

    class GoogleLoginHandler(tornado.web.RequestHandler,
                             tornado.auth.GoogleMixin):
       @tornado.gen.coroutine
       def get(self):
           if self.get_argument("openid.mode", None):
               user = yield self.get_authenticated_user()
               # Save the user with e.g. set_secure_cookie()
           else:
               yield self.authenticate_redirect()

Definition at line 883 of file auth.py.


Member Function Documentation

Subclasses must override this to return their OAuth consumer keys.

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

Reimplemented from tornado.auth.OAuthMixin.

Definition at line 966 of file auth.py.

def tornado.auth.GoogleMixin._oauth_get_user_future (   self,
  access_token 
) [private]

Definition at line 973 of file auth.py.

def tornado.auth.GoogleMixin.authorize_redirect (   self,
  oauth_scope,
  callback_uri = None,
  ax_attrs = ["name",
  email,
  language,
  username,
  callback = None 
)
Authenticates and authorizes for the given Google resource.

Some of the available resources which can be used in the ``oauth_scope``
argument are:

* Gmail Contacts - http://www.google.com/m8/feeds/
* Calendar - http://www.google.com/calendar/feeds/
* Finance - http://finance.google.com/finance/feeds/

You can authorize multiple resources by separating the resource
URLs with a space.

.. versionchanged:: 3.1
   Returns a `.Future` and takes an optional callback.  These are
   not strictly necessary as this method is synchronous,
   but they are supplied for consistency with
   `OAuthMixin.authorize_redirect`.

Definition at line 919 of file auth.py.

def tornado.auth.GoogleMixin.get_authenticated_user (   self,
  callback 
)
Fetches the authenticated user data upon redirect.

Definition at line 947 of file auth.py.


Member Data Documentation

string tornado::auth.GoogleMixin::_OAUTH_ACCESS_TOKEN_URL = "https://www.google.com/accounts/OAuthGetAccessToken" [static, private]

Definition at line 916 of file auth.py.

string tornado::auth.GoogleMixin::_OPENID_ENDPOINT = "https://www.google.com/accounts/o8/ud" [static, private]

Definition at line 915 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