Class: Force::Middleware::Authorization

Inherits:
Force::Middleware show all
Defined in:
lib/force/middleware/authorization.rb

Overview

Middleware that simply injects the OAuth token into the request headers.

Constant Summary collapse

AUTH_HEADER =
'Authorization'.freeze

Instance Method Summary collapse

Methods inherited from Force::Middleware

#client, #connection, #initialize

Constructor Details

This class inherits a constructor from Force::Middleware

Instance Method Details

#call(env) ⇒ Object


6
7
8
9
# File 'lib/force/middleware/authorization.rb', line 6

def call(env)
  env[:request_headers][AUTH_HEADER] = %(OAuth #{token})
  @app.call(env)
end

#tokenObject


11
12
13
# File 'lib/force/middleware/authorization.rb', line 11

def token
  @options[:oauth_token]
end