Package oauth2client :: Module appengine |
[hide private]
[frames] | no frames]

# Module appengine

source code

    Utilities for Google App Engine

    Utilities for making it easier to use OAuth 2.0 on Google App Engine.

Author: jcgregorio@google.com (Joe Gregorio)

Classes | [hide private]
| InvalidClientSecretsError The client_secrets.json file is malformed or missing required fields.
| InvalidXsrfTokenError The XSRF token is invalid or expired.
| SiteXsrfSecretKey Storage for the sites XSRF secret key.
| SiteXsrfSecretKeyNDB NDB Model for storage for the sites XSRF secret key.
| AppAssertionCredentials Credentials object for App Engine Assertion Grants
| FlowProperty App Engine datastore Property for Flow.
| FlowNDBProperty App Engine NDB datastore Property for Flow.
| CredentialsProperty App Engine datastore Property for Credentials.
| CredentialsNDBProperty App Engine NDB datastore Property for Credentials.
| StorageByKeyName Store and retrieve a credential to and from the App Engine datastore.
| CredentialsModel Storage for OAuth 2.0 Credentials
| CredentialsNDBModel NDB Model for storage of OAuth 2.0 Credentials
| OAuth2Decorator Utility for making OAuth 2.0 easier.
| OAuth2DecoratorFromClientSecrets An OAuth2Decorator that builds from a clientsecrets file.

Functions | [hide private]
_safe_html(s) Escape text to make it safe to display. | source code
_generate_new_xsrf_secret_key() Returns a random XSRF secret key. | source code
xsrf_secret_key() Return the secret key for use for XSRF protection. | source code
_build_state_value(request_handler, user) Composes the value for the 'state' parameter. | source code
_parse_state_value(state, user) Parse the value of the 'state' parameter. | source code
oauth2decorator_from_clientsecrets(filename, scope, message=None, cache=None) Creates an OAuth2Decorator populated from a clientsecrets file. | source code

Variables | [hide private]
| ndb = `None`
| logger = `logging.getLogger(__name__)`
| OAUTH2CLIENT_NAMESPACE = `'oauth2client#ns'`
| XSRF_MEMCACHE_ID = `'xsrf_secret_key'`

Function Details | [hide private]

### _safe_html(s) | source code
    Escape text to make it safe to display.

    Args:
      s: string, The text to escape.

    Returns:
      The escaped text as a string.

### xsrf_secret_key() | source code
    Return the secret key for use for XSRF protection.

    If the Site entity does not have a secret key, this method will also create
    one and persist it.

    Returns:
      The secret key.

### _build_state_value(request_handler, user) | source code
    Composes the value for the 'state' parameter.

    Packs the current request URI and an XSRF token into an opaque string that
    can be passed to the authentication server via the 'state' parameter.

    Args:
      request_handler: webapp.RequestHandler, The request.
      user: google.appengine.api.users.User, The current user.

    Returns:
      The state value as a string.

### _parse_state_value(state, user) | source code
    Parse the value of the 'state' parameter.

    Parses the value and validates the XSRF token in the state parameter.

    Args:
      state: string, The value of the state parameter.
      user: google.appengine.api.users.User, The current user.

    Raises:
      InvalidXsrfTokenError: if the XSRF token is invalid.

    Returns:
      The redirect URI.

### oauth2decorator_from_clientsecrets(filename, scope, message=None, cache=None) | source code
    Creates an OAuth2Decorator populated from a clientsecrets file.

    Args:
      filename: string, File name of client secrets.
      scope: string or list of strings, scope(s) of the credentials being
        requested.
      message: string, A friendly string to display to the user if the
        clientsecrets file is missing or invalid. The message may contain HTML and
        will be presented on the web interface for any method that uses the
        decorator.
      cache: An optional cache service client that implements get() and set()
        methods. See clientsecrets.loadfile() for details.

    Returns: An OAuth2Decorator
Decorators: `@util.positional(2)`