summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKhaled Hussein <khaled.hussein@gmail.com>2011-04-26 19:17:28 +0000
committerKhaled Hussein <khaled.hussein@gmail.com>2011-04-26 19:17:28 +0000
commita73d34631fef2c6300838753602d938ff29c88ab (patch)
tree50b22eef2025dfc49408022018974bf6569240b1
parent34a80873994a972abfbba0d6611e88726bbdb343 (diff)
draft remote proxy: needs fixing
-rw-r--r--keystone/auth_protocol/auth_protocol_token.ini15
-rw-r--r--keystone/auth_protocol/auth_protocol_token.py15
2 files changed, 28 insertions, 2 deletions
diff --git a/keystone/auth_protocol/auth_protocol_token.ini b/keystone/auth_protocol/auth_protocol_token.ini
new file mode 100644
index 00000000..8ee8bb6a
--- /dev/null
+++ b/keystone/auth_protocol/auth_protocol_token.ini
@@ -0,0 +1,15 @@
+[DEFAULT]
+
+[app:main]
+paste.app_factory = auth_protocol_token:app_factory
+auth_host = 127.0.0.1
+auth_port = 8080
+auth_token = 999888777666
+delegated = 0
+
+service_protocol = http
+service_host = 127.0.0.1
+service_port = 8090
+service_pass = dTpw
+
+
diff --git a/keystone/auth_protocol/auth_protocol_token.py b/keystone/auth_protocol/auth_protocol_token.py
index cc926b57..6d882162 100644
--- a/keystone/auth_protocol/auth_protocol_token.py
+++ b/keystone/auth_protocol/auth_protocol_token.py
@@ -145,14 +145,15 @@ class TokenAuth(object):
env['HTTP_X_IDENTITY_STATUS'] = "Confirmed"
if self.app is None:
+ req = Request(env)
# We are forwarding to a remote service
- forward = Request.copy()
+ forward = Request.copy(req)
forward.host = '%s:%s' % (self.service_host, self.service_port)
# we need to tell the service who we are by authenticating to it
if self.delegated:
env['HTTP_X_IDENTITY_STATUS'] = "Confirmed"
forward.environ['HTTP_AUTHORIZATION'] = "Basic dTpw"
- service_resp = forward.getresponse()
+ service_resp = forward.get_response()
data = service_resp.read()
start_response(service_resp.status, service_resp.getheaders())
return data
@@ -170,3 +171,13 @@ def filter_factory(global_conf, **local_conf):
return TokenAuth(app, conf)
return auth_filter
+def app_factory(global_conf, **local_conf):
+ conf = global_conf.copy()
+ conf.update(local_conf)
+ return TokenAuth(None, conf)
+
+if __name__ == "__main__":
+ app = loadapp("config:" + \
+ os.path.join(os.path.abspath(os.path.dirname(__file__)),
+ "auth_protocol_token.ini"), global_conf={"log_name": "echo.log"})
+ wsgi.server(eventlet.listen(('', 8090)), app)