Class: Weary::Middleware::BasicAuth
- Inherits:
-
Object
- Object
- Weary::Middleware::BasicAuth
- Defined in:
- lib/weary/middleware/basic_auth.rb
Constant Summary collapse
- AUTH_HEADER =
"HTTP_AUTHORIZATION"
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, *credentials) ⇒ BasicAuth
constructor
A new instance of BasicAuth.
Constructor Details
#initialize(app, *credentials) ⇒ BasicAuth
Returns a new instance of BasicAuth.
6 7 8 9 |
# File 'lib/weary/middleware/basic_auth.rb', line 6 def initialize(app, *credentials) @app = app @auth = [credentials.join(':')].pack('m*') end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 |
# File 'lib/weary/middleware/basic_auth.rb', line 11 def call(env) env.update AUTH_HEADER => "Basic #{@auth}" @app.call(env) end |