Class: CommandTower::Auth::AuthContext
- Inherits:
-
Data
- Object
- Data
- CommandTower::Auth::AuthContext
- Defined in:
- app/auth/command_tower/auth/auth_context.rb
Instance Attribute Summary collapse
-
#actor_user ⇒ Object
readonly
Returns the value of attribute actor_user.
-
#generated_token ⇒ Object
readonly
Returns the value of attribute generated_token.
-
#impersonation_session_id ⇒ Object
readonly
Returns the value of attribute impersonation_session_id.
-
#principal_type ⇒ Object
readonly
Returns the value of attribute principal_type.
-
#roles ⇒ Object
readonly
Returns the value of attribute roles.
-
#token_expires_at ⇒ Object
readonly
Returns the value of attribute token_expires_at.
-
#token_source ⇒ Object
readonly
Returns the value of attribute token_source.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(user:, token_expires_at:, token_source:, roles:, principal_type:, generated_token: nil, actor_user: nil, impersonation_session_id: nil) ⇒ AuthContext
constructor
A new instance of AuthContext.
Constructor Details
#initialize(user:, token_expires_at:, token_source:, roles:, principal_type:, generated_token: nil, actor_user: nil, impersonation_session_id: nil) ⇒ AuthContext
Returns a new instance of AuthContext.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'app/auth/command_tower/auth/auth_context.rb', line 15 def initialize(user:, token_expires_at:, token_source:, roles:, principal_type:, generated_token: nil, actor_user: nil, impersonation_session_id: nil) super( user:, token_expires_at:, token_source:, roles:, principal_type:, generated_token:, actor_user: actor_user || user, impersonation_session_id: ) end |
Instance Attribute Details
#actor_user ⇒ Object (readonly)
Returns the value of attribute actor_user
5 6 7 |
# File 'app/auth/command_tower/auth/auth_context.rb', line 5 def actor_user @actor_user end |
#generated_token ⇒ Object (readonly)
Returns the value of attribute generated_token
5 6 7 |
# File 'app/auth/command_tower/auth/auth_context.rb', line 5 def generated_token @generated_token end |
#impersonation_session_id ⇒ Object (readonly)
Returns the value of attribute impersonation_session_id
5 6 7 |
# File 'app/auth/command_tower/auth/auth_context.rb', line 5 def impersonation_session_id @impersonation_session_id end |
#principal_type ⇒ Object (readonly)
Returns the value of attribute principal_type
5 6 7 |
# File 'app/auth/command_tower/auth/auth_context.rb', line 5 def principal_type @principal_type end |
#roles ⇒ Object (readonly)
Returns the value of attribute roles
5 6 7 |
# File 'app/auth/command_tower/auth/auth_context.rb', line 5 def roles @roles end |
#token_expires_at ⇒ Object (readonly)
Returns the value of attribute token_expires_at
5 6 7 |
# File 'app/auth/command_tower/auth/auth_context.rb', line 5 def token_expires_at @token_expires_at end |
#token_source ⇒ Object (readonly)
Returns the value of attribute token_source
5 6 7 |
# File 'app/auth/command_tower/auth/auth_context.rb', line 5 def token_source @token_source end |
#user ⇒ Object (readonly)
Returns the value of attribute user
5 6 7 |
# File 'app/auth/command_tower/auth/auth_context.rb', line 5 def user @user end |
Class Method Details
.from_authenticate_session_result(data:, metadata:) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'app/auth/command_tower/auth/auth_context.rb', line 28 def self.from_authenticate_session_result(data:, metadata:) new( user: data[:user], token_expires_at: data[:token_expires_at], token_source: [:token_source], roles: data[:user].roles, principal_type: :user, generated_token: data[:generated_token], actor_user: data[:actor_user] || data[:user], impersonation_session_id: data[:impersonation_session_id] ) end |