Incorporated Swauth into Swift as an optional DevAuth replacement.

This commit is contained in:
gholt
2010-12-01 17:08:49 -08:00
parent a595321c97
commit 35f3487879
28 changed files with 2580 additions and 45 deletions

View File

@@ -1,7 +1,12 @@
# sample config
auth_host = 127.0.0.1
# For DevAuth:
auth_port = 11000
# For Swauth:
# auth_port = 8080
auth_ssl = no
# For Swauth:
# auth_prefix = /auth/
# Primary functional test account (needs admin access to the account)
account = test

View File

@@ -82,6 +82,7 @@ class Connection(object):
self.auth_host = config['auth_host']
self.auth_port = int(config['auth_port'])
self.auth_ssl = config['auth_ssl'] in ('on', 'true', 'yes', '1')
self.auth_prefix = config.get('auth_prefix', '/')
self.account = config['account']
self.username = config['username']
@@ -105,11 +106,11 @@ class Connection(object):
return
headers = {
'x-storage-user': self.username,
'x-storage-pass': self.password,
'x-auth-user': '%s:%s' % (self.account, self.username),
'x-auth-key': self.password,
}
path = '/v1/%s/auth' % (self.account)
path = '%sv1.0' % (self.auth_prefix)
if self.auth_ssl:
connection = httplib.HTTPSConnection(self.auth_host,
port=self.auth_port)