Railsで特定箇所だけBASIC認証

まず全体にbasic認証(実際使う場合はEnvなどからname/paswordを取得する)

vim app/controllers/application_controller.rb
class ApplicationController < ActionController::Base
  before_action :site_http_basic_authenticate_with
  def site_http_basic_authenticate_with
    authenticate_or_request_with_http_basic("Application") do |name, password|
      name == "hoge" && password == "hoge"
    end
  end
end

特定のControllerだけskipする

skip_before_action :site_http_basic_authenticate_with