Class: SignIn::ClientConfigsController

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

Constant Summary

Constants included from ExceptionHandling

ExceptionHandling::SKIP_SENTRY_EXCEPTION_TYPES

Constants included from ServiceAccountAuthentication

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

#client_config_paramsObject (private)



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

def client_config_params
  params.require(:client_config).permit(:client_id, :authentication, :redirect_uri, :refresh_token_duration,
                                        :access_token_duration, :access_token_audience, :logout_redirect_uri,
                                        :pkce, :terms_of_use_url, :enforced_terms, :shared_sessions, :anti_csrf,
                                        :description, certificates: [], access_token_attributes: [],
                                                      service_levels: [], credential_service_providers: [])
end

#createObject



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

def create
  client_config = SignIn::ClientConfig.new(client_config_params)

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

#destroyObject



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

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

#indexObject



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

def index
  client_configs = SignIn::ClientConfig.where(client_id: params[:client_ids])

  render json: client_configs, status: :ok
end

#not_foundObject (private)



59
60
61
# File 'app/controllers/sign_in/client_configs_controller.rb', line 59

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

#set_client_configObject (private)



55
56
57
# File 'app/controllers/sign_in/client_configs_controller.rb', line 55

def set_client_config
  @client_config = SignIn::ClientConfig.find_by!(client_id: params[:client_id])
end

#showObject



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

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

#updateObject



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

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