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 |
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.
def tornado.auth.OAuthMixin._oauth_access_token_url | ( | self, | |
request_token | |||
) | [private] |
def tornado.auth.OAuthMixin._oauth_consumer_token | ( | self | ) | [private] |
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.
def tornado.auth.OAuthMixin._oauth_get_user | ( | self, | |
access_token, | |||
callback | |||
) | [private] |
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.
def tornado.auth.OAuthMixin._oauth_request_parameters | ( | self, | |
url, | |||
access_token, | |||
parameters = {} , |
|||
method = "GET" |
|||
) | [private] |
def tornado.auth.OAuthMixin._oauth_request_token_url | ( | self, | |
callback_uri = None , |
|||
extra_params = None |
|||
) | [private] |
def tornado.auth.OAuthMixin._on_access_token | ( | self, | |
future, | |||
response | |||
) | [private] |
def tornado.auth.OAuthMixin._on_oauth_get_user | ( | self, | |
access_token, | |||
future, | |||
user_future | |||
) | [private] |
def tornado.auth.OAuthMixin._on_request_token | ( | self, | |
authorize_url, | |||
callback_uri, | |||
callback, | |||
response | |||
) | [private] |
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`.
def tornado.auth.OAuthMixin.get_auth_http_client | ( | self | ) |
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.