Class: InheritedProofingController

Inherits:
ApplicationController show all
Defined in:
app/controllers/inherited_proofing_controller.rb

Constant Summary collapse

BEARER_PATTERN =
/^Bearer /

Constants inherited from ApplicationController

ApplicationController::VERSION_STATUS

Constants included from ExceptionHandling

ExceptionHandling::SKIP_SENTRY_EXCEPTION_TYPES

Instance Method Summary collapse

Methods inherited from ApplicationController

#clear_saved_form, #cors_preflight, #routing_error

Methods included from Traceable

#set_trace_tags

Methods included from SentryLogging

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

Methods included from SignIn::Authentication

#authenticate, #authenticate_service_account, #load_user

Methods included from Headers

#block_unknown_hosts, #set_app_info_headers

Methods included from AuthenticationAndSSOConcerns

#authenticate, #clear_session, #extend_session!, #load_user, #log_sso_info, #render_unauthorized, #reset_session, #set_api_cookie!, #set_session_expiration_header, #sso_logging_info, #validate_inbound_login_params, #validate_session

Instance Method Details

#authObject



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

def auth
  auth_code = InheritedProofing::MHV::InheritedProofingVerifier.new(@current_user).perform

  raise unless auth_code

  render body: logingov_inherited_proofing_service.render_auth(auth_code:),
         content_type: 'text/html'
rescue => e
  render json: { errors: e }, status: :bad_request
end

#callbackObject



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

def callback
  validate_auth_code(params[:auth_code].presence)
  save_inherited_proofing_verification
  reset_session
  redirect_to controller: 'v1/sessions', action: :new, type: SAML::User::LOGINGOV_CSID
rescue => e
  render json: { errors: e }, status: :bad_request
end

#user_attributesObject



28
29
30
31
32
33
34
# File 'app/controllers/inherited_proofing_controller.rb', line 28

def user_attributes
  user_attributes = InheritedProofing::UserAttributesFetcher.new(auth_code: @auth_code).perform
  encrypted_attributes = InheritedProofing::UserAttributesEncryptor.new(user_attributes:).perform
  render json: { data: encrypted_attributes }
rescue => e
  render json: { errors: e }, status: :bad_request
end