Skip to content

Instantly share code, notes, and snippets.

@clayg
Created May 22, 2014 22:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save clayg/8378436d6772ac6fae3c to your computer and use it in GitHub Desktop.
Save clayg/8378436d6772ac6fae3c to your computer and use it in GitHub Desktop.
diff --git a/swift/common/middleware/keystoneauth.py b/swift/common/middleware/keystoneauth.py
index 096af45..16c9efd 100644
--- a/swift/common/middleware/keystoneauth.py
+++ b/swift/common/middleware/keystoneauth.py
@@ -88,7 +88,7 @@ class KeystoneAuth(object):
self.allow_overrides = swift_utils.config_true_value(config_overrides)
def __call__(self, environ, start_response):
- identity = self._keystone_identity(environ)
+ identity = self._integral_keystone_identity(environ)
# Check if one of the middleware like tempurl or formpost have
# set the swift.authorize_override environ and want to control the
@@ -134,6 +134,8 @@ class KeystoneAuth(object):
def _integral_keystone_identity(self, environ):
"""Extract the identity from the Keystone auth component."""
+ if 'keystone.identity' in environ:
+ return environ['keystone.identity']
if environ.get('HTTP_X_IDENTITY_STATUS') != 'Confirmed':
return
roles = []
diff --git a/swift/common/wsgi.py b/swift/common/wsgi.py
index 19d5c68..d6f7b5a 100644
--- a/swift/common/wsgi.py
+++ b/swift/common/wsgi.py
@@ -579,7 +579,7 @@ def make_env(env, method=None, path=None, agent='Swift', query_string=None,
'HTTP_ORIGIN', 'HTTP_ACCESS_CONTROL_REQUEST_METHOD',
'SERVER_PROTOCOL', 'swift.cache', 'swift.source',
'swift.trans_id', 'swift.authorize_override',
- 'swift.authorize'):
+ 'swift.authorize', 'keystone.identity'):
if name in env:
newenv[name] = env[name]
if method:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment