Class: Rack::Client::Auth::Basic

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/client/auth.rb

Instance Method Summary collapse

Constructor Details

#initialize(app, username, password) ⇒ Basic

Returns a new instance of Basic.



3
4
5
# File 'lib/rack/client/auth.rb', line 3

def initialize(app, username, password)
  @app, @username, @password = app, username, password
end

Instance Method Details

#call(env) ⇒ Object



7
8
9
10
11
# File 'lib/rack/client/auth.rb', line 7

def call(env)
   = ["#{@username}:#{@password}"].pack("m*")
  env['HTTP_AUTHORIZATION'] = "Basic #{}"
  @app.call(env)
end