1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/app/controllers/action_mailbox/base_controller.rb

16 lines
546 B
Ruby
Raw Normal View History

class ActionMailbox::BaseController < ActionController::Base
skip_forgery_protection
private
def authenticate
2018-10-29 13:45:24 -04:00
if username.present? && password.present?
authenticate_or_request_with_http_basic("Action Mailbox") do |given_username, given_password|
ActiveSupport::SecurityUtils.secure_compare(given_username, username) &
ActiveSupport::SecurityUtils.secure_compare(given_password, password)
end
else
raise ArgumentError, "Missing required ingress credentials"
end
end
end