diff --git a/heat/common/config.py b/heat/common/config.py index d26cd4910a..fbd4bf07f5 100644 --- a/heat/common/config.py +++ b/heat/common/config.py @@ -369,6 +369,13 @@ volumes_opts = [ "This is a temporary workaround until cinder-backup " "service becomes discoverable, see LP#1334856."))] +noauth_group = cfg.OptGroup('noauth') +noauth_opts = [ + cfg.StrOpt('token_response', + default='', + help=_("JSON file containing the content returned by the " + "noauth middleware."))] + def startup_sanity_check(): if (not cfg.CONF.stack_user_domain_id and @@ -403,6 +410,7 @@ def list_opts(): yield auth_password_group.name, auth_password_opts yield revision_group.name, revision_opts yield volumes_group.name, volumes_opts + yield noauth_group.name, noauth_opts yield profiler.list_opts()[0] yield 'clients', default_clients_opts diff --git a/heat/common/noauth.py b/heat/common/noauth.py index a111c279e4..88351e19b9 100644 --- a/heat/common/noauth.py +++ b/heat/common/noauth.py @@ -16,6 +16,10 @@ """Middleware that accepts any authentication.""" +import json +import os + +from oslo_config import cfg from oslo_log import log as logging LOG = logging.getLogger(__name__) @@ -25,6 +29,11 @@ class NoAuthProtocol(object): def __init__(self, app, conf): self.conf = conf self.app = app + self._token_info = {} + response_file = cfg.CONF.noauth.token_response + if os.path.exists(response_file): + with open(response_file) as f: + self._token_info = json.loads(f.read()) def __call__(self, env, start_response): """Handle incoming request. @@ -56,6 +65,8 @@ class NoAuthProtocol(object): 'HTTP_X_SERVICE_CATALOG': {}, 'HTTP_X_AUTH_USER': username, 'HTTP_X_AUTH_KEY': 'unset', + 'HTTP_X_AUTH_URL': 'url', + 'keystone.token_info': self._token_info, } return headers