Class: SignIn::ServiceAccountConfigsController

Inherits:
ServiceAccountApplicationController show all
Defined in:
app/controllers/sign_in/service_account_configs_controller.rb

Constant Summary

Constants included from ExceptionHandling

ExceptionHandling::SKIP_SENTRY_EXCEPTION_TYPES

Constants included from ServiceAccountAuthentication

SignIn::ServiceAccountAuthentication::BEARER_PATTERN

Constants included from Authentication

Authentication::BEARER_PATTERN

Instance Attribute Summary

Attributes inherited from ServiceAccountApplicationController

#current_user

Instance Method Summary collapse

Methods included from Traceable

#set_trace_tags

Methods included from SentryControllerLogging

#set_tags_and_extra_context, #tags_context, #user_context

Methods included from SentryLogging

#log_exception_to_sentry, #log_message_to_sentry, #non_nil_hash?, #normalize_level, #rails_logger, #set_sentry_metadata

Methods included from Headers

#set_app_info_headers

Methods included from ExceptionHandling

#render_errors, #report_mapped_exception, #report_original_exception, #skip_sentry_exception?, #skip_sentry_exception_types

Methods included from ServiceAccountAuthentication

#authenticate_service_account, #authenticate_service_account_access_token, #bearer_token, #handle_authenticate_error, #validate_requested_scope

Methods included from Authentication

#access_token, #access_token_authenticate, #authenticate, #authenticate_access_token, #bearer_token, #cookie_access_token, #handle_authenticate_error, #load_user, #load_user_object, #scrub_bearer_token, #validate_request_ip

Instance Method Details

#createObject



19
20
21
22
23
24
25
26
27
# File 'app/controllers/sign_in/service_account_configs_controller.rb', line 19

def create
   = ServiceAccountConfig.new()

  if .save
    render json: , status: :created
  else
    render json: { errors: .errors }, status: :unprocessable_entity
  end
end

#destroyObject



37
38
39
40
41
42
43
# File 'app/controllers/sign_in/service_account_configs_controller.rb', line 37

def destroy
  if @service_account_config.destroy
    head :no_content
  else
    render json: { errors: @service_account_config.errors }, status: :unprocessable_entity
  end
end

#indexObject



9
10
11
12
13
# File 'app/controllers/sign_in/service_account_configs_controller.rb', line 9

def index
   = ServiceAccountConfig.where(service_account_id: params[:service_account_ids])

  render json: , status: :ok
end

#not_foundObject (private)



61
62
63
# File 'app/controllers/sign_in/service_account_configs_controller.rb', line 61

def not_found
  render json: { errors: { service_account_config: ['not found'] } }, status: :not_found
end

#service_account_config_paramsObject (private)



47
48
49
50
51
52
53
54
55
# File 'app/controllers/sign_in/service_account_configs_controller.rb', line 47

def 
  params.require(:service_account_config).permit(:service_account_id,
                                                 :description,
                                                 :access_token_audience,
                                                 :access_token_duration,
                                                 scopes: [],
                                                 certificates: [],
                                                 access_token_user_attributes: [])
end

#set_service_account_configObject (private)



57
58
59
# File 'app/controllers/sign_in/service_account_configs_controller.rb', line 57

def 
  @service_account_config = ServiceAccountConfig.find_by!(service_account_id: params[:service_account_id])
end

#showObject



15
16
17
# File 'app/controllers/sign_in/service_account_configs_controller.rb', line 15

def show
  render json: @service_account_config, status: :ok
end

#updateObject



29
30
31
32
33
34
35
# File 'app/controllers/sign_in/service_account_configs_controller.rb', line 29

def update
  if @service_account_config.update()
    render json: @service_account_config, status: :ok
  else
    render json: { errors: @service_account_config.errors }, status: :unprocessable_entity
  end
end