Browse Source

Add support for www_authenticate_uri in ContextHook

* Added support for www_authenticate_uri in ContextHook.
* Made code path consistent with keystone.py impl.

Story: 2004271
Task: 28073

Change-Id: I7e3f23964a55be3255e87a4c4af7bae0a1415676
changes/06/619806/5
Erik Olof Gunnar Andersson 3 years ago
parent
commit
f27bde7171
  1. 9
      magnum/api/hooks.py

9
magnum/api/hooks.py

@ -16,7 +16,8 @@ from pecan import hooks
from magnum.common import context
from magnum.conductor import api as conductor_api
import magnum.conf
import magnum.conf.keystone
CONF = magnum.conf.CONF
@ -57,7 +58,11 @@ class ContextHook(hooks.PecanHook):
roles = headers.get('X-Roles', '').split(',')
auth_token_info = state.request.environ.get('keystone.token_info')
auth_url = CONF.keystone_authtoken.auth_uri
conf = CONF[magnum.conf.keystone.CFG_LEGACY_GROUP]
auth_url = (getattr(conf, 'www_authenticate_uri', None) or
getattr(conf, 'auth_uri', None))
if auth_url:
auth_url = auth_url.replace('v2.0', 'v3')
state.request.context = context.make_context(
auth_token=auth_token,

Loading…
Cancel
Save