Method: ExvoAuth::Controllers::Base#authenticate_app_in_scope!

Defined in:
lib/exvo_auth/controllers/base.rb

#authenticate_app_in_scope!(scope) ⇒ Object



45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/exvo_auth/controllers/base.rb', line 45

def authenticate_app_in_scope!(scope)
  raise("SSL not configured. Your api needs to be exposed using https protocol.") unless request.ssl? || Exvo::Helpers.auth_require_ssl == false

  send(basic_authentication_method_name) do |app_id, access_token|
    current_scopes = ExvoAuth::Autonomous::Provider.new(
      :app_id       => app_id,
      :access_token => access_token
    ).scopes

    @current_app_id = app_id

    current_scopes.include?(scope.to_s)
  end
end