Class: Rack::Auth::Signature

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/rack/auth/signature.rb,
lib/rack/auth/signature/helpers.rb

Defined Under Namespace

Modules: Helpers

Instance Method Summary collapse

Methods included from Helpers::Configuration

default_covered_components

Constructor Details

#initialize(app, options = {}, &block) ⇒ Signature

Returns a new instance of Signature.



18
19
20
21
22
# File 'lib/rack/auth/signature.rb', line 18

def initialize(app, options = {}, &block)
  @app = app
  @options = load_options(Hash(options))
  instance_eval(&block) if block
end

Instance Method Details

#call(env) ⇒ Object



24
25
26
27
28
29
30
31
32
33
# File 'lib/rack/auth/signature.rb', line 24

def call(env)
  @request = Rack::Request.new(env)

  if excluded? || allowed?
    @app.call(env)
  else
    response = options[:signatures][:error_response].values
    Rack::Response.new(*response).finish
  end
end