Class: VectorMCP::Security::AuthResult
- Inherits:
-
Object
- Object
- VectorMCP::Security::AuthResult
- Defined in:
- lib/vector_mcp/security/auth_result.rb
Overview
Value object representing the outcome of an authentication attempt. Replaces the unstructured Hash that previously flowed through the auth pipeline.
Instance Attribute Summary collapse
-
#authenticated_at ⇒ Object
readonly
Returns the value of attribute authenticated_at.
-
#strategy ⇒ Object
readonly
Returns the value of attribute strategy.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Class Method Summary collapse
- .failure ⇒ Object
- .passthrough ⇒ Object
- .success(user:, strategy:, authenticated_at: Time.now) ⇒ Object
Instance Method Summary collapse
- #authenticated? ⇒ Boolean
-
#initialize(authenticated:, user: nil, strategy: nil, authenticated_at: nil) ⇒ AuthResult
constructor
A new instance of AuthResult.
Constructor Details
#initialize(authenticated:, user: nil, strategy: nil, authenticated_at: nil) ⇒ AuthResult
Returns a new instance of AuthResult.
10 11 12 13 14 15 16 |
# File 'lib/vector_mcp/security/auth_result.rb', line 10 def initialize(authenticated:, user: nil, strategy: nil, authenticated_at: nil) @authenticated = authenticated @user = user @strategy = strategy @authenticated_at = authenticated_at || (Time.now if authenticated) freeze end |
Instance Attribute Details
#authenticated_at ⇒ Object (readonly)
Returns the value of attribute authenticated_at.
8 9 10 |
# File 'lib/vector_mcp/security/auth_result.rb', line 8 def authenticated_at @authenticated_at end |
#strategy ⇒ Object (readonly)
Returns the value of attribute strategy.
8 9 10 |
# File 'lib/vector_mcp/security/auth_result.rb', line 8 def strategy @strategy end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
8 9 10 |
# File 'lib/vector_mcp/security/auth_result.rb', line 8 def user @user end |
Class Method Details
.failure ⇒ Object
24 25 26 |
# File 'lib/vector_mcp/security/auth_result.rb', line 24 def self.failure new(authenticated: false) end |
.passthrough ⇒ Object
28 29 30 |
# File 'lib/vector_mcp/security/auth_result.rb', line 28 def self.passthrough new(authenticated: true) end |
.success(user:, strategy:, authenticated_at: Time.now) ⇒ Object
20 21 22 |
# File 'lib/vector_mcp/security/auth_result.rb', line 20 def self.success(user:, strategy:, authenticated_at: Time.now) new(authenticated: true, user: user, strategy: strategy, authenticated_at: authenticated_at) end |
Instance Method Details
#authenticated? ⇒ Boolean
18 |
# File 'lib/vector_mcp/security/auth_result.rb', line 18 def authenticated? = @authenticated |