Class: JScrambler::Middleware::Authentication
- Inherits:
-
Object
- Object
- JScrambler::Middleware::Authentication
- Defined in:
- lib/jscrambler/middleware/authentication.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = {}) ⇒ Authentication
constructor
A new instance of Authentication.
Constructor Details
#initialize(app, options = {}) ⇒ Authentication
Returns a new instance of Authentication.
5 6 7 |
# File 'lib/jscrambler/middleware/authentication.rb', line 5 def initialize(app, = {}) @app, @options, @config = app, , JScrambler::Config.new.to_hash end |
Instance Method Details
#call(env) ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/jscrambler/middleware/authentication.rb', line 9 def call(env) env.body[:signature] = hmac_params_signature(env) if [:get, :delete].include? env.method env.url += "?#{URI.encode_www_form(env.body)}" env.body = nil end @app.call(env) end |