Class: CommandTower::Workflows::Auth::AuthenticateRequestWorkflow
- Inherits:
-
CommandTower::Workflows::ApplicationWorkflow
- Object
- CommandTower::Workflows::ApplicationWorkflow
- CommandTower::Workflows::Auth::AuthenticateRequestWorkflow
- Defined in:
- app/workflows/command_tower/workflows/auth/authenticate_request_workflow.rb
Constant Summary
Constants inherited from CommandTower::Workflows::ApplicationWorkflow
CommandTower::Workflows::ApplicationWorkflow::ALLOWED_RETRY_STRATEGIES, CommandTower::Workflows::ApplicationWorkflow::InvalidTransactionResult, CommandTower::Workflows::ApplicationWorkflow::TransactionFailure
Instance Method Summary collapse
Methods inherited from CommandTower::Workflows::ApplicationWorkflow
call, call_from_job, continuation_max_attempts, declared_retry_strategy, mark_impersonation_activity!, retry_strategy, validate_retry_strategy!
Methods included from Impersonation::ActivityDeclaration
Methods included from Logging::LifecycleDeclaration
Methods included from Execution::ContextAccess
#audit, #execution_context, #log_debug, #log_error, #log_info, #log_warn, #publish_event
Methods included from Transactional
#fail_transaction!, #transaction
Instance Method Details
#call(request:, response:, bypass_email_validation: false, overlay_mode: :enforce) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'app/workflows/command_tower/workflows/auth/authenticate_request_workflow.rb', line 9 def call(request:, response:, bypass_email_validation: false, overlay_mode: :enforce) request_context = CommandTower::Auth::RequestContext.from(request, response) auth_result = CommandTower::Services::Auth::AuthenticateSession.call( request_context: request_context, bypass_email_validation: bypass_email_validation, overlay_mode: ) unless auth_result.success? return failure( errors: auth_result.errors, http_status: SessionErrorStatus.http_status_for(auth_result.errors.first), response_effects: AuthenticationResponseEffects.for_auth_failure(auth_result.).presence ) end auth_context = CommandTower::Auth::AuthContext.from_authenticate_session_result( data: auth_result.data, metadata: auth_result. ) success( payload: { current_user: auth_context.user, auth_context: auth_context }, http_status: :ok ) end |