Class: Transistor::Middleware::Authentication

Inherits:
Faraday::Middleware
  • Object
show all
Defined in:
lib/transistor/middleware/authentication.rb

Constant Summary collapse

AUTHORIZATION_HEADER =
'Authorization'.freeze
CONTENT_TYPE_HEADER =
'Content-Type'.freeze

Instance Method Summary collapse

Instance Method Details

#call(env) ⇒ Object



13
14
15
16
# File 'lib/transistor/middleware/authentication.rb', line 13

def call(env)
  env[:request_headers][AUTHORIZATION_HEADER] = authorize_request(env)
  @app.call(env)
end

#initalize(app, options = {}) ⇒ Object



9
10
11
# File 'lib/transistor/middleware/authentication.rb', line 9

def initalize(app, options = {})
  super(app)
end