Class: Rack::Auth::Basic
- Inherits:
-
AbstractHandler
- Object
- AbstractHandler
- Rack::Auth::Basic
- Defined in:
- lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rack-2.2.5/lib/rack/auth/basic.rb
Overview
Rack::Auth::Basic implements HTTP Basic Authentication, as per RFC 2617.
Initialize with the Rack application that you want protecting, and a block that checks if a username and password pair are valid.
See also: example/protectedlobster.rb
Defined Under Namespace
Classes: Request
Instance Attribute Summary
Attributes inherited from AbstractHandler
Instance Method Summary collapse
Methods inherited from AbstractHandler
Constructor Details
This class inherits a constructor from Rack::Auth::AbstractHandler
Instance Method Details
#call(env) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/rack-2.2.5/lib/rack/auth/basic.rb', line 18 def call(env) auth = Basic::Request.new(env) return unless auth.provided? return bad_request unless auth.basic? if valid?(auth) env['REMOTE_USER'] = auth.username return @app.call(env) end end |