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

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.

No application registration is necessary to use Google for authentication
or to access Google resources on behalf of a user. To authenticate with
Google, redirect with authenticate_redirect(). On return, parse the
response with get_authenticated_user(). We send a dict containing the
values for the user, including 'email', 'name', and 'locale'.
Example usage::

    class GoogleHandler(tornado.web.RequestHandler, tornado.auth.GoogleMixin):
       @tornado.web.asynchronous
       def get(self):
           if self.get_argument("openid.mode", None):
               self.get_authenticated_user(self.async_callback(self._on_auth))
               return
        self.authenticate_redirect()

        def _on_auth(self, user):
            if not user:
                raise tornado.web.HTTPError(500, "Google auth failed")
            # Save the user with, e.g., set_secure_cookie()

Definition at line 690 of file auth.py.


Member Function Documentation

Definition at line 753 of file auth.py.

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

Reimplemented from tornado.auth.OAuthMixin.

Definition at line 760 of file auth.py.

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

Some of the available resources 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.

Definition at line 717 of file auth.py.

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

Definition at line 735 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 715 of file auth.py.

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

Definition at line 714 of file auth.py.


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


rosbridge_server
Author(s): Jonathan Mace
autogenerated on Mon Oct 6 2014 06:58:14