Class: Otto::Security::Authentication::AuthFailure

Inherits:
Data
  • Object
show all
Defined in:
lib/otto/security/authentication/auth_failure.rb

Overview

Failure result for authentication failures

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(failure_reason:, auth_method:, terminal: false) ⇒ AuthFailure

terminal defaults to false so existing keyword construction (failure_reason:, auth_method:) is unaffected.



37
38
39
# File 'lib/otto/security/authentication/auth_failure.rb', line 37

def initialize(failure_reason:, auth_method:, terminal: false)
  super
end

Instance Attribute Details

#auth_methodObject (readonly)

Returns the value of attribute auth_method

Returns:

  • (Object)

    the current value of auth_method



9
10
11
# File 'lib/otto/security/authentication/auth_failure.rb', line 9

def auth_method
  @auth_method
end

#failure_reasonObject (readonly)

Returns the value of attribute failure_reason

Returns:

  • (Object)

    the current value of failure_reason



9
10
11
# File 'lib/otto/security/authentication/auth_failure.rb', line 9

def failure_reason
  @failure_reason
end

#terminalObject (readonly)

Returns the value of attribute terminal

Returns:

  • (Object)

    the current value of terminal



9
10
11
# File 'lib/otto/security/authentication/auth_failure.rb', line 9

def terminal
  @terminal
end

Instance Method Details

#anonymous?Boolean

Check if anonymous - always true for failures

Returns:

  • (Boolean)

    True (failures have no user)



58
59
60
# File 'lib/otto/security/authentication/auth_failure.rb', line 58

def anonymous?
  true
end

#authenticated?Boolean

Check if authenticated - always false for failures

Returns:

  • (Boolean)

    False (failures are never authenticated)



51
52
53
# File 'lib/otto/security/authentication/auth_failure.rb', line 51

def authenticated?
  false
end

#inspectString

Create a string representation for debugging

Returns:

  • (String)

    Debug representation



72
73
74
# File 'lib/otto/security/authentication/auth_failure.rb', line 72

def inspect
  "#<AuthFailure reason=#{failure_reason.inspect} method=#{auth_method}#{' terminal' if terminal}>"
end

#terminal?Boolean

Check if this failure halts the strategy chain

Returns:

  • (Boolean)

    True when the chain must fail closed



44
45
46
# File 'lib/otto/security/authentication/auth_failure.rb', line 44

def terminal?
  terminal
end

#user_contextHash

Get empty user context for failures

Returns:

  • (Hash)

    Empty hash



65
66
67
# File 'lib/otto/security/authentication/auth_failure.rb', line 65

def user_context
  {}
end