From daf395b5e85bfa1f91612dda7030b3089ca4da7a Mon Sep 17 00:00:00 2001 From: Chmouel Boudjnah Date: Tue, 22 May 2012 15:01:38 +0000 Subject: [PATCH] Use X_USER_NAME and X_ROLES headers. - Don't use deprecated headers X_USER and X_ROLE but the newest one X_USER_NAME and X_ROLES. - Fixes bug 999447. Change-Id: I12752c7668863cbb47ee4b6e484cc494133443e8 --- keystone/middleware/swift_auth.py | 6 +++--- tests/test_swift_auth_middleware.py | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/keystone/middleware/swift_auth.py b/keystone/middleware/swift_auth.py index 19f8cab9a6..08c0090902 100644 --- a/keystone/middleware/swift_auth.py +++ b/keystone/middleware/swift_auth.py @@ -125,9 +125,9 @@ class SwiftAuth(object): if environ.get('HTTP_X_IDENTITY_STATUS') != 'Confirmed': return roles = [] - if 'HTTP_X_ROLE' in environ: - roles = environ['HTTP_X_ROLE'].split(',') - identity = {'user': environ.get('HTTP_X_USER'), + if 'HTTP_X_ROLES' in environ: + roles = environ['HTTP_X_ROLES'].split(',') + identity = {'user': environ.get('HTTP_X_USER_NAME'), 'tenant': (environ.get('HTTP_X_TENANT_ID'), environ.get('HTTP_X_TENANT_NAME')), 'roles': roles} diff --git a/tests/test_swift_auth_middleware.py b/tests/test_swift_auth_middleware.py index ea585a76af..7b432e8ece 100644 --- a/tests/test_swift_auth_middleware.py +++ b/tests/test_swift_auth_middleware.py @@ -70,8 +70,8 @@ class SwiftAuth(unittest.TestCase): return dict(X_IDENTITY_STATUS=status, X_TENANT_ID=tenant_id, X_TENANT_NAME=tenant_name, - X_ROLE=role, - X_USER=user) + X_ROLES=role, + X_USER_NAME=user) def _get_successful_middleware(self): response_iter = iter([('200 OK', {}, '')])