diff options
| author | mo khan <mo@mokhan.ca> | 2014-06-03 11:13:30 -0600 |
|---|---|---|
| committer | mo khan <mo@mokhan.ca> | 2014-06-03 11:13:30 -0600 |
| commit | 63fd1834aebe5dcc84b559f947c3fee2b319ec36 (patch) | |
| tree | 7b0aa34c0cacc4b80d8cb158417b2a25684095fa | |
| parent | 7198ec66dedbe3820e0da1f61778b50b364c54f7 (diff) | |
require json and write errors to console.main
| -rw-r--r-- | client/config.ru | 8 |
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"]] } |
