Class: Api::GraphqlController

Instance Method Summary collapse

Methods included from Foreman::Controller::BruteforceProtection

#bruteforce_attempt?

Methods included from Foreman::Controller::Authentication

#authorized, #available_sso, #check_user_enabled, #is_admin?, #path_to_authenticate, #require_login

Methods included from Foreman::Controller::Session

#backup_session_content, #expire_session, #ignore_api_request?, #session_expiry, #set_activity_time, #update_activity_time

Methods included from Foreman::Controller::Timezone

#set_timezone

Methods included from Foreman::ThreadSession::Cleaner

#clear_thread

Instance Method Details

#api_request?Boolean

Returns:

  • (Boolean)

27
28
29
# File 'app/controllers/api/graphql_controller.rb', line 27

def api_request?
  true
end

#authenticateObject


31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'app/controllers/api/graphql_controller.rb', line 31

def authenticate
  if bruteforce_attempt?
    log_bruteforce
    render_error('Bruteforce attempt.', status: :unauthorized)
    return false
  end

  authenticated = super

   if available_sso.present? && !authenticated

  authenticated
end

#executeObject


17
18
19
20
21
22
23
24
25
# File 'app/controllers/api/graphql_controller.rb', line 17

def execute
  result = if params[:_json]
             execute_multiplexed_graphql_query
           else
             execute_single_graphql_query
           end

  render json: result
end