fix error with swauth-clean-tokens

Error is caused by left-over code from swauth. It had hard-coded
the auth account to .auth. Changed code to use volume specified
in the config file

Change-Id: Id00eb3964b6b26a84511e4753ab80b2dea5654da
Signed-off-by: Thiago da Silva <thiago@redhat.com>
Reviewed-on: http://review.gluster.org/6280
Reviewed-by: Luis Pabon <lpabon@redhat.com>
Tested-by: Luis Pabon <lpabon@redhat.com>
This commit is contained in:
Thiago da Silva 2013-11-15 17:13:53 -05:00 committed by Luis Pabon
parent c6d7ddc4bc
commit f8ae648c6d
2 changed files with 35 additions and 1 deletions

View File

@ -1173,7 +1173,7 @@ class Swauth(object):
if user == '.super_admin' and self.super_admin_key and \
key == self.super_admin_key:
token = self.get_itoken(req.environ)
url = '%s/%s.auth' % (self.dsc_url, self.reseller_prefix)
url = '%s/%s' % (self.dsc_url, self.auth_account)
return Response(
request=req,
body=json.dumps(

View File

@ -804,6 +804,40 @@ class TestAuth(unittest.TestCase):
self.assertEquals(resp.status_int, 500)
self.assertEquals(self.test_auth.app.calls, 2)
def test_get_token_for_auth_acct_success(self):
local_auth = \
auth.filter_factory({
'super_admin_key': 'supertest',
'metadata_volume': 'gsmd',
'token_life': str(DEFAULT_TOKEN_LIFE),
'max_token_life': str(MAX_TOKEN_LIFE)})(FakeApp())
resp = Request.blank(
'/auth/v1.0',
environ={'REQUEST_METHOD': 'GET',
'swift.cache': FakeMemcache()},
headers={'X-Auth-User': 'act:.super_admin',
'X-Auth-Key': 'supertest'}).get_response(local_auth)
self.assertEquals(resp.status_int, 200)
itk = resp.headers.get('x-auth-token')
self.assertTrue(itk.startswith('AUTH_itk'), itk)
self.assertEquals(resp.headers.get('x-storage-url'),
'http://127.0.0.1:8080/v1/AUTH_gsmd')
def test_get_token_for_auth_acct_fail_passwd(self):
local_auth = \
auth.filter_factory({
'super_admin_key': 'supertest',
'metadata_volume': 'gsmd',
'token_life': str(DEFAULT_TOKEN_LIFE),
'max_token_life': str(MAX_TOKEN_LIFE)})(FakeApp())
resp = Request.blank(
'/auth/v1.0',
environ={'REQUEST_METHOD': 'GET',
'swift.cache': FakeMemcache()},
headers={'X-Auth-User': 'act:.super_admin',
'X-Auth-Key': 'invalidpasswd'}).get_response(local_auth)
self.assertEquals(resp.status_int, 401)
def test_get_token_success_v1_0(self):
self.test_auth.app = FakeApp(iter([
# GET of user object