From ac72522f457a860c30396fe0db22fbcffb61e977 Mon Sep 17 00:00:00 2001 From: Hua Wang Date: Fri, 21 Aug 2015 05:46:32 +0800 Subject: [PATCH] X-User is deprecated and X-Storage-Token is useless X-User is deprecated. X-Storage-Token is supported for swift/cloud files and legacy Rackspace use in [1], so it is not needed in magnum. [1] http://docs.openstack.org/developer/keystonemiddleware/ middlewarearchitecture.html#exchanging-user-information Change-Id: I48913c79b506210448ecd23769a98458f54adbe6 Closes-Bug: #1489801 --- magnum/api/hooks.py | 11 +++++------ magnum/tests/unit/api/test_hooks.py | 2 ++ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/magnum/api/hooks.py b/magnum/api/hooks.py index ba9632d8c8..9839a6b5c2 100644 --- a/magnum/api/hooks.py +++ b/magnum/api/hooks.py @@ -28,8 +28,8 @@ class ContextHook(hooks.PecanHook): The following HTTP request headers are used: - X-User: - Used for context.user. + X-User-Name: + Used for context.user_name. X-User-Id: Used for context.user_id. @@ -47,14 +47,13 @@ class ContextHook(hooks.PecanHook): def before(self, state): headers = state.request.headers - user = headers.get('X-User') + user_name = headers.get('X-User-Name') user_id = headers.get('X-User-Id') project = headers.get('X-Project-Name') project_id = headers.get('X-Project-Id') domain_id = headers.get('X-User-Domain-Id') domain_name = headers.get('X-User-Domain-Name') - auth_token = headers.get('X-Storage-Token') - auth_token = headers.get('X-Auth-Token', auth_token) + auth_token = headers.get('X-Auth-Token') auth_token_info = state.request.environ.get('keystone.token_info') auth_url = headers.get('X-Auth-Url') @@ -66,7 +65,7 @@ class ContextHook(hooks.PecanHook): auth_token=auth_token, auth_url=auth_url, auth_token_info=auth_token_info, - user_name=user, + user_name=user_name, user_id=user_id, project_name=project, project_id=project_id, diff --git a/magnum/tests/unit/api/test_hooks.py b/magnum/tests/unit/api/test_hooks.py index 2bec645103..39939292f8 100644 --- a/magnum/tests/unit/api/test_hooks.py +++ b/magnum/tests/unit/api/test_hooks.py @@ -43,6 +43,8 @@ class TestContextHook(base.BaseTestCase): fakes.fakeAuthTokenHeaders['X-Auth-Token']) self.assertEqual(ctx.project_id, fakes.fakeAuthTokenHeaders['X-Project-Id']) + self.assertEqual(ctx.user_name, + fakes.fakeAuthTokenHeaders['X-User-Name']) self.assertEqual(ctx.user_id, fakes.fakeAuthTokenHeaders['X-User-Id']) self.assertEqual(ctx.auth_url,