Class: DelayedJobMetrics::BasicAuth

Inherits:
Rack::Auth::Basic
  • Object
show all
Defined in:
lib/delayed_job_metrics/http_basic_auth.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#call(env, callback) ⇒ Object



6
7
8
9
10
11
12
13
14
# File 'lib/delayed_job_metrics/http_basic_auth.rb', line 6

def call(env, callback)
  auth = ::Rack::Auth::Basic::Request.new(env)

  return unauthorized unless auth.provided?
  return bad_request unless auth.basic?
  return callback.call(env) if valid?(auth)

  unauthorized
end