diff options
| author | Michael Gundlach <michael.gundlach@rackspace.com> | 2010-11-29 17:26:05 -0600 |
|---|---|---|
| committer | Michael Gundlach <michael.gundlach@rackspace.com> | 2010-11-29 17:26:05 -0600 |
| commit | 8ee658e7f6da2484377bec7652f37df7259f9e8a (patch) | |
| tree | e73050847277be7f3ca73428117f32e9cd04887b /nova/api | |
| parent | 4112e432c6a7b0e82bfc72fac0ceae8eca8bba49 (diff) | |
| download | nova-8ee658e7f6da2484377bec7652f37df7259f9e8a.tar.gz nova-8ee658e7f6da2484377bec7652f37df7259f9e8a.tar.xz nova-8ee658e7f6da2484377bec7652f37df7259f9e8a.zip | |
Return the correct server_management_url
Diffstat (limited to 'nova/api')
| -rw-r--r-- | nova/api/openstack/auth.py | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/nova/api/openstack/auth.py b/nova/api/openstack/auth.py index ff428ff70..f91742b37 100644 --- a/nova/api/openstack/auth.py +++ b/nova/api/openstack/auth.py @@ -47,7 +47,7 @@ class BasicApiAuthManager(object): except KeyError: return faults.Fault(webob.exc.HTTPUnauthorized()) - token, user = self._authorize_user(username, key) + token, user = self._authorize_user(username, key, req) if user and token: res = webob.Response() res.headers['X-Auth-Token'] = token.token_hash @@ -82,8 +82,13 @@ class BasicApiAuthManager(object): return {'id': user.id} return None - def _authorize_user(self, username, key): - """ Generates a new token and assigns it to a user """ + def _authorize_user(self, username, key, req): + """Generates a new token and assigns it to a user. + + username - string + key - string API key + req - webob.Request object + """ user = self.auth.get_user_from_access_key(key) if user and user.name == username: token_hash = hashlib.sha1('%s%s%f' % (username, key, @@ -91,12 +96,10 @@ class BasicApiAuthManager(object): token_dict = {} token_dict['token_hash'] = token_hash token_dict['cdn_management_url'] = '' - token_dict['server_management_url'] = self._get_server_mgmt_url() + # Same as auth url, e.g. http://foo.org:8774/baz/v1.0 + token_dict['server_management_url'] = req.url token_dict['storage_url'] = '' token_dict['user_id'] = user.id token = self.db.auth_create_token(self.context, token_dict) return token, user return None, None - - def _get_server_mgmt_url(self): - return 'https://%s/v1.0/' % self.host |
