Class: V0::MapServicesController
- Inherits:
-
SignIn::ServiceAccountApplicationController
- Object
- ActionController::API
- SignIn::ServiceAccountApplicationController
- V0::MapServicesController
- Defined in:
- app/controllers/v0/map_services_controller.rb
Constant Summary
Constants included from ExceptionHandling
ExceptionHandling::SKIP_SENTRY_EXCEPTION_TYPES
Constants included from SignIn::ServiceAccountAuthentication
SignIn::ServiceAccountAuthentication::BEARER_PATTERN
Constants included from SignIn::Authentication
SignIn::Authentication::BEARER_PATTERN
Instance Attribute Summary
Attributes inherited from SignIn::ServiceAccountApplicationController
Instance Method Summary collapse
- #application_mismatch_error ⇒ Object private
- #missing_icn_error ⇒ Object private
- #sts_client_error ⇒ Object private
-
#token ⇒ Object
POST /v0/map_services/:application/token.
Methods included from Traceable
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
Methods included from ExceptionHandling
#render_errors, #report_mapped_exception, #report_original_exception, #skip_sentry_exception?, #skip_sentry_exception_types
Methods included from SignIn::ServiceAccountAuthentication
#authenticate_service_account, #authenticate_service_account_access_token, #bearer_token, #handle_authenticate_error, #validate_requested_scope
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
Instance Method Details
#application_mismatch_error ⇒ Object (private)
31 32 33 34 35 36 |
# File 'app/controllers/v0/map_services_controller.rb', line 31 def application_mismatch_error { error: 'invalid_request', error_description: 'Application mismatch detected.' } end |
#missing_icn_error ⇒ Object (private)
38 39 40 41 42 43 |
# File 'app/controllers/v0/map_services_controller.rb', line 38 def missing_icn_error { error: 'invalid_request', error_description: 'Service account access token does not contain an ICN in `user_attributes` claim.' } end |
#sts_client_error ⇒ Object (private)
24 25 26 27 28 29 |
# File 'app/controllers/v0/map_services_controller.rb', line 24 def sts_client_error { error: 'server_error', error_description: 'STS failed to return a valid token.' } end |
#token ⇒ Object
POST /v0/map_services/:application/token
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/v0/map_services_controller.rb', line 9 def token icn = @service_account_access_token.user_attributes['icn'] result = MAP::SecurityToken::Service.new.token(application: params[:application].to_sym, icn:, cache: false) render json: result, status: :ok rescue Common::Client::Errors::ClientError, Common::Exceptions::GatewayTimeout render json: sts_client_error, status: :bad_gateway rescue MAP::SecurityToken::Errors::ApplicationMismatchError render json: application_mismatch_error, status: :bad_request rescue MAP::SecurityToken::Errors::MissingICNError render json: missing_icn_error, status: :bad_request end |