Merge "X-User is deprecated and X-Storage-Token is useless"

This commit is contained in:
Jenkins 2015-08-31 23:05:28 +00:00 committed by Gerrit Code Review
commit 8424490ea0
2 changed files with 7 additions and 6 deletions

View File

@ -28,8 +28,8 @@ class ContextHook(hooks.PecanHook):
The following HTTP request headers are used: The following HTTP request headers are used:
X-User: X-User-Name:
Used for context.user. Used for context.user_name.
X-User-Id: X-User-Id:
Used for context.user_id. Used for context.user_id.
@ -47,14 +47,13 @@ class ContextHook(hooks.PecanHook):
def before(self, state): def before(self, state):
headers = state.request.headers headers = state.request.headers
user = headers.get('X-User') user_name = headers.get('X-User-Name')
user_id = headers.get('X-User-Id') user_id = headers.get('X-User-Id')
project = headers.get('X-Project-Name') project = headers.get('X-Project-Name')
project_id = headers.get('X-Project-Id') project_id = headers.get('X-Project-Id')
domain_id = headers.get('X-User-Domain-Id') domain_id = headers.get('X-User-Domain-Id')
domain_name = headers.get('X-User-Domain-Name') domain_name = headers.get('X-User-Domain-Name')
auth_token = headers.get('X-Storage-Token') auth_token = headers.get('X-Auth-Token')
auth_token = headers.get('X-Auth-Token', auth_token)
auth_token_info = state.request.environ.get('keystone.token_info') auth_token_info = state.request.environ.get('keystone.token_info')
auth_url = headers.get('X-Auth-Url') auth_url = headers.get('X-Auth-Url')
@ -66,7 +65,7 @@ class ContextHook(hooks.PecanHook):
auth_token=auth_token, auth_token=auth_token,
auth_url=auth_url, auth_url=auth_url,
auth_token_info=auth_token_info, auth_token_info=auth_token_info,
user_name=user, user_name=user_name,
user_id=user_id, user_id=user_id,
project_name=project, project_name=project,
project_id=project_id, project_id=project_id,

View File

@ -43,6 +43,8 @@ class TestContextHook(base.BaseTestCase):
fakes.fakeAuthTokenHeaders['X-Auth-Token']) fakes.fakeAuthTokenHeaders['X-Auth-Token'])
self.assertEqual(ctx.project_id, self.assertEqual(ctx.project_id,
fakes.fakeAuthTokenHeaders['X-Project-Id']) fakes.fakeAuthTokenHeaders['X-Project-Id'])
self.assertEqual(ctx.user_name,
fakes.fakeAuthTokenHeaders['X-User-Name'])
self.assertEqual(ctx.user_id, self.assertEqual(ctx.user_id,
fakes.fakeAuthTokenHeaders['X-User-Id']) fakes.fakeAuthTokenHeaders['X-User-Id'])
self.assertEqual(ctx.auth_url, self.assertEqual(ctx.auth_url,