diff options
| author | Ziad Sawalha <gihub@highbridgellc.com> | 2011-04-25 14:11:12 -0700 |
|---|---|---|
| committer | Ziad Sawalha <gihub@highbridgellc.com> | 2011-04-25 14:11:12 -0700 |
| commit | 0f05c73bbdd4acaf6ec005561b059f34f25e57cb (patch) | |
| tree | f06e188fe5704711dec77c88b4257c0ae18d4c64 | |
| parent | d279860452b4c998d94a248efa342519a96fbeaf (diff) | |
| parent | 6686cdc791188ace9d231b14d2254b2d8ed405bd (diff) | |
| download | keystone-0f05c73bbdd4acaf6ec005561b059f34f25e57cb.tar.gz keystone-0f05c73bbdd4acaf6ec005561b059f34f25e57cb.tar.xz keystone-0f05c73bbdd4acaf6ec005561b059f34f25e57cb.zip | |
Merged pull request #30 from cloudbuilders/master.
Fixes Issue #29
| -rw-r--r-- | echo/echo/echo.ini | 2 | ||||
| -rw-r--r-- | echo/echo/echo.py | 26 | ||||
| -rw-r--r-- | keystone/auth_protocol/auth_protocol_token.py | 25 |
3 files changed, 16 insertions, 37 deletions
diff --git a/echo/echo/echo.ini b/echo/echo/echo.ini index a0d5caeb..0b86d11f 100644 --- a/echo/echo/echo.ini +++ b/echo/echo/echo.ini @@ -5,7 +5,7 @@ paste.app_factory = echo:app_factory [pipeline:main] pipeline = - auth + auth papiauth echo diff --git a/echo/echo/echo.py b/echo/echo/echo.py index 1219f877..37e5ea84 100644 --- a/echo/echo/echo.py +++ b/echo/echo/echo.py @@ -69,17 +69,7 @@ class EchoApp(object): def toJSON(self): self.start('200 OK', [('Content-Type', 'application/json')]) - token = str(self.envr.get("HTTP_X_AUTH_TOKEN", "")) - - if token != '': - res = self.ValidateToken({'type': 'json', 'token': token}) - if int(res['response']['status']) == 200: - yield str(res['content']) - else: - pass - # Need to Do Something Here - else: - yield str(self.transform(self.dom)) + yield str(self.transform(self.dom)) def toXML(self): self.start('200 OK', [('Content-Type', 'application/xml')]) @@ -101,20 +91,6 @@ class EchoApp(object): return echo - #def ValidateToken(self,params): - # if params['token']: - # http = Http() - # url = "http://localhost:8080/token/"+str(params['token']) - # body = {} - # headers = { - # "Accept": "application/json", - # "Content-Type": "application/json"} - # response, content = http.request(url, 'GET', headers=headers, - # body = urllib.urlencode(body)) - # return {'response': response, 'content': content} - # else: - # return abort(401, "No Token Found!") - def app_factory(global_conf, **local_conf): return EchoApp diff --git a/keystone/auth_protocol/auth_protocol_token.py b/keystone/auth_protocol/auth_protocol_token.py index dc35bf32..23617999 100644 --- a/keystone/auth_protocol/auth_protocol_token.py +++ b/keystone/auth_protocol/auth_protocol_token.py @@ -42,23 +42,26 @@ class TokenAuth(object): token = env.get('HTTP_X_AUTH_TOKEN', env.get('HTTP_X_STORAGE_TOKEN')) if token: - #conn = http_connect(self.auth_host, self.auth_port, 'GET', - # '/token/%s' % token) - #resp = conn.getresponse() - path = 'http://%s:%s/token/%s' % \ - (self.auth_host, self.auth_port, token) - resp = Request.blank(path).get_response(self.app) - user = json.loads(resp.body) - #resp.read() - #conn.close() - if not resp.status.startswith('20'): + # NOTE(vish): Not sure what the logic behind this other token is + headers = {'X-Auth-Token': '999888777666'} + conn = http_connect(self.auth_host, self.auth_port, 'GET', + '/v1.0/token/%s' % token, headers=headers) + resp = conn.getresponse() + data = resp.read() + conn.close() + #path = 'http://%s:%s/v1.0/token/%s' % \ + # (self.auth_host, self.auth_port, token) + #resp = Request.blank(path).get_response(self.app) + #data = resp.body + dict_response = json.loads(data) + user = dict_response['auth']['user']['username'] + if not str(resp.status).startswith('20'): if self.delegated: env['HTTP_X_IDENTITY_STATUS'] = "Invalid" else: env['HTTP_X_AUTHORIZATION'] = "Proxy " + user if self.delegated: env['HTTP_X_IDENTITY_STATUS'] = "Confirmed" - return HTTPUnauthorized()(env, custom_start_response) env['HTTP_AUTHORIZATION'] = "Basic dTpw" return self.app(env, custom_start_response) |
