# Allow orchestration of multiple clouds (boolean value)
#multi_cloud=false
-# Allowed targets for auth_uri when multi_cloud is enabled.
-# If empty, all targets will be allowed. (list value)
+# Allowed keystone endpoints for auth_uri when multi_cloud is
+# enabled. At least one endpoint needs to be specified. (list
+# value)
#allowed_auth_uris=
'X-Auth-Url'))
return resp(env, start_response)
allowed = cfg.CONF.auth_password.allowed_auth_uris
- if allowed and not auth_url in allowed:
- resp = HTTPUnauthorized(_('Header X-Auth-Url "%s" not allowed')
+ if auth_url not in allowed:
+ resp = HTTPUnauthorized(_('Header X-Auth-Url "%s" not an allowed '
+ 'endpoint')
% auth_url)
return resp(env, start_response)
return None
help=_('Allow orchestration of multiple clouds')),
cfg.ListOpt('allowed_auth_uris',
default=[],
- help=_('Allowed targets for auth_uri when multi_cloud is '
- 'enabled. If empty, all targets will be allowed.'))]
+ help=_('Allowed keystone endpoints for auth_uri when '
+ 'multi_cloud is enabled. At least one endpoint needs '
+ 'to be specified.'))]
cfg.CONF.register_opts(db_opts)
cfg.CONF.register_opts(engine_opts)
self.middleware(req.environ, self._start_fake_response)
self.assertEqual(self.response_status, 401)
- def _test_multi_cloud(self, allowed_auth_uris=[]):
+ def test_multi_cloud(self):
+ allowed_auth_uris = ['http://multicloud.test.com:5000/v2.0']
cfg.CONF.set_override('multi_cloud', True, group='auth_password')
auth_url = 'http://multicloud.test.com:5000/v2.0'
cfg.CONF.set_override('allowed_auth_uris',
self.middleware(req.environ, self._start_fake_response)
self.m.VerifyAll()
- def test_multi_cloud(self):
- self._test_multi_cloud(['http://multicloud.test.com:5000/v2.0'])
-
def test_multi_cloud_empty_allowed_uris(self):
- self._test_multi_cloud()
+ cfg.CONF.set_override('multi_cloud', True, group='auth_password')
+ auth_url = 'http://multicloud.test.com:5000/v2.0'
+ cfg.CONF.set_override('allowed_auth_uris',
+ [],
+ group='auth_password')
+ req = webob.Request.blank('/tenant_id1/')
+ req.headers['X_AUTH_USER'] = 'user_name1'
+ req.headers['X_AUTH_KEY'] = 'goodpassword'
+ req.headers['X_AUTH_URL'] = auth_url
+ self.middleware(req.environ, self._start_fake_response)
+ self.assertEqual(self.response_status, 401)
def test_multi_cloud_target_not_allowed(self):
cfg.CONF.set_override('multi_cloud', True, group='auth_password')