Class: Escher::RackMiddleware

Inherits:
Object
  • Object
show all
Extended by:
Authenticator, Credential, ExcludePath, IncludePath, Logging
Includes:
DefaultOptions
Defined in:
lib/escher/rack_middleware.rb

Instance Method Summary collapse

Methods included from Logging

extended, logger, logger=

Methods included from Credential

add_credential, add_credential_updater, credentials, extended

Methods included from ExcludePath

add_exclude_paths, excluded_paths, extended

Methods included from IncludePath

add_include_paths, extended, included_paths

Methods included from Authenticator

add_escher_authenticator, escher_authenticators, extended

Constructor Details

#initialize(app, options = {}) ⇒ RackMiddleware

Returns a new instance of RackMiddleware.



19
20
21
22
# File 'lib/escher/rack_middleware.rb', line 19

def initialize(app, options = {})
  @app = app
  @options = options
end

Instance Method Details

#call(request_env) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/escher/rack_middleware.rb', line 24

def call(request_env)
  if authorize_path?(::Rack::Utils.clean_path_info(request_env[::Rack::PATH_INFO]))
    return unauthorized_response unless authorized?(request_env)
  end

  @app.call(request_env)
end