mirror of
https://github.com/internetee/registry.git
synced 2025-06-06 04:37:30 +02:00
parent
640faaadb9
commit
42e8f86dae
51 changed files with 1619 additions and 53 deletions
18
app/controllers/api/v1/base_controller.rb
Normal file
18
app/controllers/api/v1/base_controller.rb
Normal file
|
@ -0,0 +1,18 @@
|
|||
require 'rails5_api_controller_backport'
|
||||
|
||||
module Api
|
||||
module V1
|
||||
class BaseController < ActionController::API
|
||||
private
|
||||
|
||||
def authenticate
|
||||
ip_allowed = allowed_ips.include?(request.remote_ip)
|
||||
head :unauthorized unless ip_allowed
|
||||
end
|
||||
|
||||
def allowed_ips
|
||||
ENV['auction_api_allowed_ips'].split(',').map(&:strip)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue