Class: Conjur::WebServer::Authorize

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

Overview

Verifies that the request contains the authorization token, and then strips it.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(app, sessionid) ⇒ Authorize

Returns a new instance of Authorize.



7
8
9
10
# File 'lib/conjur/webserver/authorize.rb', line 7

def initialize(app, sessionid)
  @app = app
  @sessionid = sessionid
end

Instance Attribute Details

#appObject (readonly)

Returns the value of attribute app.



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

def app
  @app
end

#sessionidObject (readonly)

Returns the value of attribute sessionid.



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

def sessionid
  @sessionid
end

Instance Method Details

#call(env) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/conjur/webserver/authorize.rb', line 12

def call(env)
  if token_valid?(env)
    @app.call env
  else
    [403, {}, ["Authorization is missing or invalid"]]
  end
end