Module: ActionController::HttpAuthentication::Basic::ControllerMethods::ClassMethods
- Defined in:
- lib/action_controller/metal/http_authentication.rb
Instance Method Summary collapse
Instance Method Details
#http_basic_authenticate_with(options = {}) ⇒ Object
71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/action_controller/metal/http_authentication.rb', line 71 def http_basic_authenticate_with( = {}) before_action(.except(:name, :password, :realm)) do authenticate_or_request_with_http_basic([:realm] || "Application") do |name, password| # This comparison uses & so that it doesn't short circuit and # uses `secure_compare` so that length information # isn't leaked. ActiveSupport::SecurityUtils.secure_compare(name, [:name]) & ActiveSupport::SecurityUtils.secure_compare(password, [:password]) end end end |