keystone.middleware package

Submodules

keystone.middleware.auth module

class keystone.middleware.auth.AuthContextMiddleware(*args, **kwargs)[source]

Bases: keystonemiddleware.auth_token.BaseAuthProtocol

Build the authentication context from the request auth token.

classmethod factory(global_config, **local_config)[source]

Used for paste app factories in paste.deploy config files.

Any local configuration (that is, values under the [filter:APPNAME] section of the paste config) will be passed into the __init__ method as kwargs.

A hypothetical configuration would look like:

[filter:analytics] redis_host = 127.0.0.1 paste.filter_factory = keystone.analytics:Analytics.factory

which would result in a call to the Analytics class as

import keystone.analytics keystone.analytics.Analytics(app, redis_host=‘127.0.0.1’)

You could of course re-implement the factory method in subclasses, but using the kwarg passing it shouldn’t be necessary.

fetch_token(token, **kwargs)[source]
fill_context(request)[source]
kwargs_to_fetch_token = True
process_request(request)[source]

keystone.middleware.core module

class keystone.middleware.core.AdminTokenAuthMiddleware(application)[source]

Bases: keystone.common.wsgi.Middleware

A trivial filter that checks for a pre-defined admin token.

Sets ‘is_admin’ to true in the context, expected to be checked by methods that are admin-only.

process_request(request)[source]
class keystone.middleware.core.JsonBodyMiddleware(application)[source]

Bases: keystone.common.wsgi.Middleware

Middleware to allow method arguments to be passed as serialized JSON.

Accepting arguments as JSON is useful for accepting data that may be more complex than simple primitives.

Filters out the parameters self, context and anything beginning with an underscore.

process_request(request)[source]
class keystone.middleware.core.NormalizingFilter(application)[source]

Bases: keystone.common.wsgi.Middleware

Middleware filter to handle URL normalization.

process_request(request)[source]

Normalize URLs.

class keystone.middleware.core.TokenAuthMiddleware(application)[source]

Bases: keystone.common.wsgi.Middleware

process_request(request)[source]

Module contents