# keystone.server.flask.request_processing.middleware.auth_context module

class keystone.server.flask.request_processing.middleware.auth_context.AuthContextMiddleware(app)

  Bases: `ProviderAPIMixin`, `BaseAuthProtocol`

  Build the authentication context from the request auth token.

  classmethod factory(global_config, **local_config)

    Used for loading in middleware (holdover from paste.deploy).

  fetch_token(token, **kwargs)

    Fetch the token data based on the value in the header.

    Retrieve the data associated with the token value that was in the header. This can be from PKI, contacting the identity server or whatever is required.

    Parameters:

      - token (str) – The token present in the request header.

      - kwargs (dict) – Additional keyword arguments may be passed through here to support new features. If an implementation is not aware of how to use these arguments it should ignore them.

    Raises:

      exc.InvalidToken – if token is invalid.

    Returns:

      The token data

    Return type:

      dict

  fill_context(request)
  kwargs_to_fetch_token = True
  process_request(request)

    Process request.

    If this method returns a value then that value will be used as the response. The next application down the stack will not be executed and process_response will not be called.

    Otherwise, the next application down the stack will be executed and process_response will be called with the generated response.

    By default this method does not return a value.

    Parameters:

      request (_request.AuthTokenRequest) – Incoming request

this page last updated: 2026-08-17 12:45:24

Except where otherwise noted, this document is licensed under Creative Commons Attribution 3.0 License. See all OpenStack Legal Documents.

found an error? report a bug