Class: Conjur::WebServer::ConjurInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/conjur/webserver/conjur_info.rb

Overview

Middleware that adds some conjur info to the rack environment

Constant Summary collapse

PROPERTIES =
%w(roleid account stack)

Instance Method Summary collapse

Constructor Details

#initialize(app) ⇒ ConjurInfo

Returns a new instance of ConjurInfo.



5
6
7
# File 'lib/conjur/webserver/conjur_info.rb', line 5

def initialize app
  @app = app
end

Instance Method Details

#accountObject



24
25
26
# File 'lib/conjur/webserver/conjur_info.rb', line 24

def 
  Conjur.
end

#call(env) ⇒ Object



9
10
11
12
# File 'lib/conjur/webserver/conjur_info.rb', line 9

def call env
  update_env env
  @app.call env
end

#roleidObject



20
21
22
# File 'lib/conjur/webserver/conjur_info.rb', line 20

def roleid
  "#{}:user:#{Conjur::Authn.get_credentials[0]}"
end

#stackObject



28
29
30
# File 'lib/conjur/webserver/conjur_info.rb', line 28

def stack
  Conjur.stack
end

#update_env(env) ⇒ Object



14
15
16
# File 'lib/conjur/webserver/conjur_info.rb', line 14

def update_env env
  PROPERTIES.each{|name| env["conjur.#{name}"] = send(name)}
end