Class: ApplicationController

Inherits:
ActionController::API
  • Object
show all
Includes:
ActionController::RequestForgeryProtection, AuthenticationAndSSOConcerns, ExceptionHandling, Headers, Instrumentation, Pundit::Authorization, SentryControllerLogging, SentryLogging, Traceable
Defined in:
app/controllers/application_controller.rb

Direct Known Subclasses

AppealsBaseController, AppealsBaseControllerV1, BBController, ClaimsBaseController, FlipperController, GIDSController, PreneedsController, RxController, SMController, V0::AdminController, V0::ApidocsController, V0::AppointmentsController, V0::AppsController, V0::AverageDaysForClaimCompletionController, V0::BackendStatusesController, V0::BannersController, V0::BenefitsClaimsController, V0::BenefitsDocumentsController, V0::BenefitsReferenceDataController, V0::BurialClaimsController, V0::CaregiversAssistanceClaimsController, V0::ClaimDocumentsController, V0::ClaimLettersController, V0::CoeController, V0::ContactUs::InquiriesController, V0::DebtLettersController, V0::DebtsController, V0::DependentsApplicationsController, V0::DependentsVerificationsController, V0::DisabilityCompensationFormsController, V0::DocumentsController, V0::EVSSBenefitsClaimsController, V0::EVSSClaimsAsyncController, V0::EVSSClaimsController, V0::EducationBenefitsClaimsController, V0::EfolderController, V0::ExampleController, V0::FeatureTogglesController, V0::Form1010EzrAttachmentsController, V0::Form1010EzrsController, V0::Form1010cg::AttachmentsController, V0::Form1095BsController, V0::FormsController, V0::GIBillFeedbacksController, V0::HCAAttachmentsController, V0::HealthCareApplicationsController, V0::IdCardAnnouncementSubscriptionController, V0::IdCardAttributesController, V0::InProgressFormsController, V0::IntentToFilesController, V0::LettersController, V0::LettersDiscrepancyController, V0::LettersGeneratorController, V0::MDOT::SuppliesController, V0::MHVOptInFlagsController, V0::MPIUsersController, V0::MaintenanceWindowsController, V0::MedicalCopaysController, V0::MyVA::SubmissionPdfUrlsController, V0::MyVA::SubmissionStatusesController, V0::OnsiteNotificationsController, V0::PPIUController, V0::Profile::AddressValidationController, V0::Profile::AddressesController, V0::Profile::CommunicationPreferencesController, V0::Profile::ConnectedApplicationsController, V0::Profile::ContactsController, V0::Profile::DirectDepositsController, V0::Profile::EmailAddressesController, V0::Profile::FullNamesController, V0::Profile::GenderIdentitiesController, V0::Profile::MilitaryOccupationsController, V0::Profile::PaymentHistoryController, V0::Profile::PermissionsController, V0::Profile::PersonalInformationsController, V0::Profile::PersonsController, V0::Profile::PreferredNamesController, V0::Profile::ServiceHistoriesController, V0::Profile::TelephonesController, V0::Profile::TransactionsController, V0::Profile::ValidVAFileNumbersController, V0::Profile::VetVerificationStatusesController, V0::RatedDisabilitiesController, V0::RatedDisabilitiesDiscrepanciesController, V0::SearchClickTrackingController, V0::SearchController, V0::SearchTypeaheadController, V0::TermsOfUseAgreementsController, V0::UploadSupportingEvidencesController, V0::User::MHVUserAccountsController, V0::UsersController, V0::VeteranOnboardingsController, V0::VirtualAgent::VirtualAgentClaimStatusController, V0::VirtualAgentClaimLettersController, V0::VirtualAgentJwtTokenController, V0::VirtualAgentSpeechTokenController, V0::VirtualAgentTokenController, V0::VirtualAgentTokenMsftController, V0::VirtualAgentTokenNluController, V1::ApidocsController, V1::DecisionReviewEvidencesController, V1::DecisionReviewNotificationCallbacksController, V1::Post911GIBillStatusesController, V1::Profile::MilitaryInfosController, V1::SessionsController

Constant Summary collapse

VERSION_STATUS =
{
  draft: 'Draft Version',
  current: 'Current Version',
  previous: 'Previous Version',
  deprecated: 'Deprecated Version'
}.freeze

Constants included from SignIn::Authentication

SignIn::Authentication::BEARER_PATTERN

Constants included from ExceptionHandling

ExceptionHandling::SKIP_SENTRY_EXCEPTION_TYPES

Instance Attribute Summary collapse

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 Instrumentation

#append_info_to_payload

Methods included from SignIn::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

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 AuthenticationAndSSOConcerns

#authenticate, #clear_session, #extend_session!, #load_user, #log_sso_info, #render_unauthorized, #reset_session, #set_api_cookie!, #set_current_user, #set_session_expiration_header, #set_session_object, #sign_in_service_exp_time, #sign_in_service_session, #sso_cookie_content, #sso_logging_info, #validate_inbound_login_params, #validate_session

Methods included from SignIn::AudienceValidator

#authenticate, #validate_audience!

Instance Attribute Details

#current_userObject (readonly, private)

Returns the value of attribute current_user.



46
47
48
# File 'app/controllers/application_controller.rb', line 46

def current_user
  @current_user
end

Instance Method Details

#clear_saved_form(form_id) ⇒ Object



40
41
42
# File 'app/controllers/application_controller.rb', line 40

def clear_saved_form(form_id)
  InProgressForm.form_for_user(form_id, current_user)&.destroy if current_user
end

#cors_preflightObject



32
33
34
# File 'app/controllers/application_controller.rb', line 32

def cors_preflight
  head(:ok)
end

#pagination_paramsObject (private)



53
54
55
56
57
58
# File 'app/controllers/application_controller.rb', line 53

def pagination_params
  {
    page: params[:page],
    per_page: params[:per_page]
  }
end

#render_job_id(jid) ⇒ Object (private)



60
61
62
# File 'app/controllers/application_controller.rb', line 60

def render_job_id(jid)
  render json: { job_id: jid }, status: :accepted
end

#routing_errorObject



36
37
38
# File 'app/controllers/application_controller.rb', line 36

def routing_error
  raise Common::Exceptions::RoutingError, params[:path]
end

#set_csrf_headerObject (private)



48
49
50
51
# File 'app/controllers/application_controller.rb', line 48

def set_csrf_header
  token = form_authenticity_token
  response.set_header('X-CSRF-Token', token)
end