Revert commit 709. This fixes issues with the Openstack API causing 'No user for access key admin' errors.
This commit is contained in:
commit
211810f9ea
@ -120,8 +120,8 @@ class AuthMiddleware(wsgi.Middleware):
|
||||
req - webob.Request object
|
||||
"""
|
||||
ctxt = context.get_admin_context()
|
||||
user = self.auth.get_user_from_access_key(username)
|
||||
if user and user.secret == key:
|
||||
user = self.auth.get_user_from_access_key(key)
|
||||
if user and user.name == username:
|
||||
token_hash = hashlib.sha1('%s%s%f' % (username, key,
|
||||
time.time())).hexdigest()
|
||||
token_dict = {}
|
||||
|
@ -221,8 +221,7 @@ class FakeAuthDatabase(object):
|
||||
class FakeAuthManager(object):
|
||||
auth_data = {}
|
||||
|
||||
def add_user(self, user):
|
||||
key = user.id
|
||||
def add_user(self, key, user):
|
||||
FakeAuthManager.auth_data[key] = user
|
||||
|
||||
def get_user(self, uid):
|
||||
@ -235,10 +234,7 @@ class FakeAuthManager(object):
|
||||
return None
|
||||
|
||||
def get_user_from_access_key(self, key):
|
||||
for k, v in FakeAuthManager.auth_data.iteritems():
|
||||
if v.access == key:
|
||||
return v
|
||||
return None
|
||||
return FakeAuthManager.auth_data.get(key, None)
|
||||
|
||||
|
||||
class FakeRateLimiter(object):
|
||||
|
@ -48,7 +48,7 @@ class Test(unittest.TestCase):
|
||||
|
||||
def test_authorize_user(self):
|
||||
f = fakes.FakeAuthManager()
|
||||
f.add_user(nova.auth.manager.User(1, 'herp', 'herp', 'derp', None))
|
||||
f.add_user('derp', nova.auth.manager.User(1, 'herp', None, None, None))
|
||||
|
||||
req = webob.Request.blank('/v1.0/')
|
||||
req.headers['X-Auth-User'] = 'herp'
|
||||
@ -62,7 +62,7 @@ class Test(unittest.TestCase):
|
||||
|
||||
def test_authorize_token(self):
|
||||
f = fakes.FakeAuthManager()
|
||||
f.add_user(nova.auth.manager.User(1, 'herp', 'herp', 'derp', None))
|
||||
f.add_user('derp', nova.auth.manager.User(1, 'herp', None, None, None))
|
||||
|
||||
req = webob.Request.blank('/v1.0/', {'HTTP_HOST': 'foo'})
|
||||
req.headers['X-Auth-User'] = 'herp'
|
||||
@ -144,7 +144,7 @@ class TestLimiter(unittest.TestCase):
|
||||
|
||||
def test_authorize_token(self):
|
||||
f = fakes.FakeAuthManager()
|
||||
f.add_user(nova.auth.manager.User(1, 'herp', 'herp', 'derp', None))
|
||||
f.add_user('derp', nova.auth.manager.User(1, 'herp', None, None, None))
|
||||
|
||||
req = webob.Request.blank('/v1.0/')
|
||||
req.headers['X-Auth-User'] = 'herp'
|
||||
|
Loading…
Reference in New Issue
Block a user