glare.api.middleware package¶
Submodules¶
glare.api.middleware.context module¶
-
class
glare.api.middleware.context.
BaseContextMiddleware
(application, conf=None)[source]¶ Bases:
oslo_middleware.base.ConfigurableMiddleware
-
class
glare.api.middleware.context.
ContextMiddleware
(application, conf=None)[source]¶ Bases:
glare.api.middleware.context.BaseContextMiddleware
-
static
process_request
(req)[source]¶ Convert authentication information into a request context.
Generate a RequestContext object from the available authentication headers and store on the ‘context’ attribute of the req object.
Parameters: req – wsgi request object that will be given the context object Raises: webob.exc.HTTPUnauthorized: when value of the X-Identity-Status header is not ‘Confirmed’ and anonymous access is disallowed
-
static
-
class
glare.api.middleware.context.
RequestContext
(service_catalog=None, **kwargs)[source]¶ Bases:
oslo_context.context.RequestContext
Stores information about the security context for Glare.
Stores how the user accesses the system, as well as additional request information.
glare.api.middleware.fault module¶
A middleware that turns exceptions into parsable string. Inspired by Cinder’s and Heat’t faultwrapper.
-
class
glare.api.middleware.fault.
GlareFaultWrapperFilter
(application, conf=None)[source]¶ Bases:
oslo_middleware.base.ConfigurableMiddleware
Replace error body with something the client can parse.
-
error_map
= {‘Exception’: <class ‘webob.exc.HTTPInternalServerError’>, ‘Locked’: <class ‘webob.exc.HTTPLocked’>, ‘Unauthorized’: <class ‘webob.exc.HTTPUnauthorized’>, ‘Gone’: <class ‘webob.exc.HTTPGone’>, ‘RequestTimeout’: <class ‘webob.exc.HTTPRequestTimeout’>, ‘PreconditionFailed’: <class ‘webob.exc.HTTPPreconditionFailed’>, ‘RequestEntityTooLarge’: <class ‘webob.exc.HTTPRequestEntityTooLarge’>, ‘UnsupportedMediaType’: <class ‘webob.exc.HTTPUnsupportedMediaType’>, ‘Conflict’: <class ‘webob.exc.HTTPConflict’>, ‘NotFound’: <class ‘webob.exc.HTTPNotFound’>, ‘RequestRangeNotSatisfiable’: <class ‘webob.exc.HTTPRequestRangeNotSatisfiable’>, ‘BadRequest’: <class ‘webob.exc.HTTPBadRequest’>, ‘FailedDependency’: <class ‘webob.exc.HTTPFailedDependency’>, ‘Forbidden’: <class ‘webob.exc.HTTPForbidden’>, ‘NotAcceptable’: <class ‘webob.exc.HTTPNotAcceptable’>}¶
-
glare.api.middleware.keycloak_auth module¶
glare.api.middleware.version_negotiation module¶
A filter middleware that inspects the requested URI for a version string and/or Accept headers and attempts to negotiate an API controller to return.
-
class
glare.api.middleware.version_negotiation.
GlareVersionNegotiationFilter
(application, conf=None)[source]¶ Bases:
oslo_middleware.base.ConfigurableMiddleware
Middleware that defines API version in request and redirects it to correct Router.
-
MIME_TYPE
= ‘application/vnd.openstack.artifacts-‘¶
-
SERVICE_TYPE
= ‘artifact’¶
-
static
get_version_from_accept
(accept_header)[source]¶ Try to parse accept header to extract api version.
Parameters: accept_header – accept header Returns: version string in the request or None if not specified
-