Class: Rack::Authenticate::Middleware
- Inherits:
-
Rack::Auth::Basic
- Object
- Rack::Auth::Basic
- Rack::Authenticate::Middleware
- Defined in:
- lib/rack/authenticate/middleware.rb
Defined Under Namespace
Classes: Auth, Configuration
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) {|@configuration| ... } ⇒ Middleware
constructor
A new instance of Middleware.
Constructor Details
#initialize(app) {|@configuration| ... } ⇒ Middleware
Returns a new instance of Middleware.
121 122 123 124 125 |
# File 'lib/rack/authenticate/middleware.rb', line 121 def initialize(app) @configuration = Configuration.new yield @configuration super(app, &@configuration.basic_auth_validation_block) end |
Instance Method Details
#call(env) ⇒ Object
127 128 129 130 131 132 133 134 135 136 |
# File 'lib/rack/authenticate/middleware.rb', line 127 def call(env) auth = Auth.new(env, @configuration) return unless auth.provided? return super(env) if auth.basic? return bad_request unless auth.hmac? return bad_request unless auth.has_all_required_parts? return unless auth.valid? @app.call(env) end |