Module: AuthOriginControl::Helpers

Extended by:
ActiveSupport::Concern
Included in:
ActionController::Base
Defined in:
lib/auth_origin_control/helpers/helpers.rb

Instance Method Summary collapse

Instance Method Details

#identify_client(_request = request) ⇒ Object



18
19
20
# File 'lib/auth_origin_control/helpers/helpers.rb', line 18

def identify_client(_request = request)
  AuthOriginControl::Base.new(_request).app
end

#origin_controlObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/auth_origin_control/helpers/helpers.rb', line 5

def origin_control
  @current_client_app = identify_client
  if _error = @current_client_app["error"]
    if self.is_a? ActionController::Base
      render :json => { "error" => _error}
    else
      error!('401 Unauthorized', 401)
    end
  else
    true
  end
end