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
This commit is contained in:
parent
b095d012e2
commit
f27bde7171
@ -16,7 +16,8 @@ from pecan import hooks
|
|||||||
|
|
||||||
from magnum.common import context
|
from magnum.common import context
|
||||||
from magnum.conductor import api as conductor_api
|
from magnum.conductor import api as conductor_api
|
||||||
import magnum.conf
|
import magnum.conf.keystone
|
||||||
|
|
||||||
|
|
||||||
CONF = magnum.conf.CONF
|
CONF = magnum.conf.CONF
|
||||||
|
|
||||||
@ -57,7 +58,11 @@ class ContextHook(hooks.PecanHook):
|
|||||||
roles = headers.get('X-Roles', '').split(',')
|
roles = headers.get('X-Roles', '').split(',')
|
||||||
auth_token_info = state.request.environ.get('keystone.token_info')
|
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(
|
state.request.context = context.make_context(
|
||||||
auth_token=auth_token,
|
auth_token=auth_token,
|
||||||
|
Loading…
Reference in New Issue
Block a user