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.
-
to_policy_values
()[source]¶ A dictionary of context attributes to enforce policy with.
oslo.policy enforcement requires a dictionary of attributes representing the current logged in user on which it applies policy enforcement. This dictionary defines a standard list of attributes that should be available for enforcement across services.
It is expected that services will often have to override this method with either deprecated values or additional attributes used by that service specific policy.
-
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
= {'BadRequest': <class 'webob.exc.HTTPBadRequest'>, 'Conflict': <class 'webob.exc.HTTPConflict'>, 'Exception': <class 'webob.exc.HTTPInternalServerError'>, 'FailedDependency': <class 'webob.exc.HTTPFailedDependency'>, 'Forbidden': <class 'webob.exc.HTTPForbidden'>, 'Gone': <class 'webob.exc.HTTPGone'>, 'Locked': <class 'webob.exc.HTTPLocked'>, 'NotAcceptable': <class 'webob.exc.HTTPNotAcceptable'>, 'NotFound': <class 'webob.exc.HTTPNotFound'>, 'PreconditionFailed': <class 'webob.exc.HTTPPreconditionFailed'>, 'RequestEntityTooLarge': <class 'webob.exc.HTTPRequestEntityTooLarge'>, 'RequestRangeNotSatisfiable': <class 'webob.exc.HTTPRequestRangeNotSatisfiable'>, 'RequestTimeout': <class 'webob.exc.HTTPRequestTimeout'>, 'Unauthorized': <class 'webob.exc.HTTPUnauthorized'>, 'UnsupportedMediaType': <class 'webob.exc.HTTPUnsupportedMediaType'>}¶
-
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
-