summaryrefslogtreecommitdiff
path: root/client/config.ru
diff options
context:
space:
mode:
Diffstat (limited to 'client/config.ru')
-rw-r--r--client/config.ru8
1 files changed, 5 insertions, 3 deletions
diff --git a/client/config.ru b/client/config.ru
index d09f59c..0e34087 100644
--- a/client/config.ru
+++ b/client/config.ru
@@ -1,3 +1,5 @@
+require 'json'
+
module Rack
class RBAC
def initialize(app, rbac_host, &block)
@@ -24,18 +26,18 @@ module Rack
def authorized?(user, resource)
response = Net::HTTP.get(@rbac_host, "/users/#{user}/authorizations?resource=#{resource}", @rbac_port)
JSON.parse(response)["authorized"]
- rescue
+ rescue => error
+ puts error.inspect
false
end
end
end
use Rack::RBAC, "localhost" do |env|
- puts env.inspect
{
user: CGI.escape(env["HTTP_X_USER"]),
resource: CGI.escape(env['PATH_INFO'])
}
end
-run Proc.new { |env| [200, { "Content-Type" => "text/html" }, "Rack::RBAC gave you access\n"] }
+run Proc.new { |env| [200, { "Content-Type" => "text/html" }, ["Rack::RBAC gave you access\n"]] }