Class: Rack::Client::Auth::Basic
- Inherits:
-
Object
- Object
- Rack::Client::Auth::Basic
- Defined in:
- lib/rack/client/auth.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, username, password) ⇒ Basic
constructor
A new instance of Basic.
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) encoded_login = ["#{@username}:#{@password}"].pack("m*") env['HTTP_AUTHORIZATION'] = "Basic #{encoded_login}" @app.call(env) end |