Module: CommandTower::Workflows::Auth::AuthenticationResponseEffects

Defined in:
app/workflows/command_tower/workflows/auth/authentication_response_effects.rb

Overview

Translates authentication observation metadata into transport effects the renderer applies. Keeps cookie mechanics out of the authentication service.

Class Method Summary collapse

Class Method Details

.for_auth_failure(metadata) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'app/workflows/command_tower/workflows/auth/authentication_response_effects.rb', line 11

def for_auth_failure()
  effects = {}
  # 412 email verification is a live session that still needs the JWT
  # cookie so the client can send/verify the code.
  if [:cookie_authenticated] && [:authentication_failed] &&
      ![:email_verification_required] &&
      ![:impersonation_session_expired]
    effects[:clear_auth_cookie] = true
  end
  effects
end