How to use http auth in ruby on rails? i hope only external ip need to do that. for example, my internal ip is "192.168.1.0/24".
class ApplicationController < ActionController::Base
USER_ID, PASSWORD = "hello", "Passw0rd#"
before_action :authenticate
def authenticate
authenticate_or_request_with_http_basic do |id, password|
id == USER_ID && password == PASSWORD
end
end
end