Class: Restfully::Rack::BasicAuth
- Inherits:
-
Object
- Object
- Restfully::Rack::BasicAuth
- Defined in:
- lib/restfully/rack/basic_auth.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, username, password) ⇒ BasicAuth
constructor
A new instance of BasicAuth.
Constructor Details
#initialize(app, username, password) ⇒ BasicAuth
Returns a new instance of BasicAuth.
6 7 8 9 10 |
# File 'lib/restfully/rack/basic_auth.rb', line 6 def initialize(app, username, password) @app = app @username = username @password = password end |
Instance Method Details
#call(env) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/restfully/rack/basic_auth.rb', line 12 def call(env) env['HTTP_AUTHORIZATION'] = [ "Basic", Base64.encode64([ @username, @password ].join(":")) ].join(" ") @app.call(env) end |