mirror of
https://github.com/internetee/registry.git
synced 2025-07-30 22:46:22 +02:00
Registrar ip restriction on every request
This commit is contained in:
parent
b86fac03b5
commit
7863322c9d
4 changed files with 7 additions and 6 deletions
|
@ -9,6 +9,7 @@ module Repp
|
||||||
before_action :set_locale
|
before_action :set_locale
|
||||||
before_action :validate_webclient_ca
|
before_action :validate_webclient_ca
|
||||||
before_action :validate_api_user_cert
|
before_action :validate_api_user_cert
|
||||||
|
before_action :check_registrar_ip_restriction
|
||||||
before_action :check_api_ip_restriction
|
before_action :check_api_ip_restriction
|
||||||
before_action :set_paper_trail_whodunnit
|
before_action :set_paper_trail_whodunnit
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,9 @@ module Repp
|
||||||
module V1
|
module V1
|
||||||
module Registrar
|
module Registrar
|
||||||
class AuthController < BaseController
|
class AuthController < BaseController
|
||||||
before_action :check_registrar_ip_restriction, only: :index
|
|
||||||
before_action :validate_webclient_user_cert, only: :index
|
before_action :validate_webclient_user_cert, only: :index
|
||||||
skip_before_action :authenticate_user, only: :tara_callback
|
skip_before_action :authenticate_user, only: :tara_callback
|
||||||
|
skip_before_action :check_registrar_ip_restriction, only: :tara_callback
|
||||||
skip_before_action :check_api_ip_restriction, only: :tara_callback
|
skip_before_action :check_api_ip_restriction, only: :tara_callback
|
||||||
skip_before_action :validate_api_user_cert, only: :tara_callback
|
skip_before_action :validate_api_user_cert, only: :tara_callback
|
||||||
|
|
||||||
|
|
|
@ -53,8 +53,8 @@ class ReppV1AccountsSwitchUserTest < ActionDispatch::IntegrationTest
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_returns_error_response_if_throttled
|
def test_returns_error_response_if_throttled
|
||||||
ENV["shunter_default_threshold"] = '1'
|
ENV['shunter_default_threshold'] = '1'
|
||||||
ENV["shunter_enabled"] = 'true'
|
ENV['shunter_enabled'] = 'true'
|
||||||
|
|
||||||
new_user = users(:api_goodnames)
|
new_user = users(:api_goodnames)
|
||||||
new_user.update(identity_code: '1234')
|
new_user.update(identity_code: '1234')
|
||||||
|
@ -71,7 +71,7 @@ class ReppV1AccountsSwitchUserTest < ActionDispatch::IntegrationTest
|
||||||
assert_response :bad_request
|
assert_response :bad_request
|
||||||
assert_equal json[:code], 2502
|
assert_equal json[:code], 2502
|
||||||
assert response.body.include?(Shunter.default_error_message)
|
assert response.body.include?(Shunter.default_error_message)
|
||||||
ENV["shunter_default_threshold"] = '10000'
|
ENV['shunter_default_threshold'] = '10000'
|
||||||
ENV["shunter_enabled"] = 'false'
|
ENV['shunter_enabled'] = 'false'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -67,7 +67,7 @@ class ReppV1BaseTest < ActionDispatch::IntegrationTest
|
||||||
|
|
||||||
Repp::V1::BaseController.stub_any_instance(:webclient_request?, true) do
|
Repp::V1::BaseController.stub_any_instance(:webclient_request?, true) do
|
||||||
Repp::V1::BaseController.stub_any_instance(:validate_webclient_ca, true) do
|
Repp::V1::BaseController.stub_any_instance(:validate_webclient_ca, true) do
|
||||||
get repp_v1_registrar_auth_index_path, headers: @auth_headers.merge!({ 'Request-IP' => whiteip.ipv4 })
|
get repp_v1_contacts_path, headers: @auth_headers.merge!({ 'Request-IP' => whiteip.ipv4 })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue