Class: WorkOS::RefreshAuthenticationResponse
- Inherits:
-
Object
- Object
- WorkOS::RefreshAuthenticationResponse
- Includes:
- HashProvider
- Defined in:
- lib/workos/refresh_authentication_response.rb
Overview
The RefreshAuthenticationResponse contains response data from a successful ‘UserManagement.authenticate_with_refresh_token` call
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Returns the value of attribute access_token.
-
#impersonator ⇒ Object
Returns the value of attribute impersonator.
-
#organization_id ⇒ Object
Returns the value of attribute organization_id.
-
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
-
#sealed_session ⇒ Object
Returns the value of attribute sealed_session.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(authentication_response_json, session = nil) ⇒ RefreshAuthenticationResponse
constructor
rubocop:disable Metrics/AbcSize.
-
#to_json ⇒ Object
rubocop:enable Metrics/AbcSize.
Methods included from HashProvider
Constructor Details
#initialize(authentication_response_json, session = nil) ⇒ RefreshAuthenticationResponse
rubocop:disable Metrics/AbcSize
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/workos/refresh_authentication_response.rb', line 12 def initialize(authentication_response_json, session = nil) json = JSON.parse(authentication_response_json, symbolize_names: true) @access_token = json[:access_token] @refresh_token = json[:refresh_token] @user = WorkOS::User.new(json[:user].to_json) @organization_id = json[:organization_id] @impersonator = if (impersonator_json = json[:impersonator]) Impersonator.new(email: impersonator_json[:email], reason: impersonator_json[:reason],) end @sealed_session = if session && session[:seal_session] WorkOS::Session.seal_data({ access_token: access_token, refresh_token: refresh_token, user: user.to_json, organization_id: organization_id, impersonator: impersonator.to_json, }, session[:cookie_password],) end end |
Instance Attribute Details
#access_token ⇒ Object
Returns the value of attribute access_token.
9 10 11 |
# File 'lib/workos/refresh_authentication_response.rb', line 9 def access_token @access_token end |
#impersonator ⇒ Object
Returns the value of attribute impersonator.
9 10 11 |
# File 'lib/workos/refresh_authentication_response.rb', line 9 def impersonator @impersonator end |
#organization_id ⇒ Object
Returns the value of attribute organization_id.
9 10 11 |
# File 'lib/workos/refresh_authentication_response.rb', line 9 def organization_id @organization_id end |
#refresh_token ⇒ Object
Returns the value of attribute refresh_token.
9 10 11 |
# File 'lib/workos/refresh_authentication_response.rb', line 9 def refresh_token @refresh_token end |
#sealed_session ⇒ Object
Returns the value of attribute sealed_session.
9 10 11 |
# File 'lib/workos/refresh_authentication_response.rb', line 9 def sealed_session @sealed_session end |
#user ⇒ Object
Returns the value of attribute user.
9 10 11 |
# File 'lib/workos/refresh_authentication_response.rb', line 9 def user @user end |
Instance Method Details
#to_json ⇒ Object
rubocop:enable Metrics/AbcSize
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/workos/refresh_authentication_response.rb', line 36 def to_json(*) { user: user.to_json, organization_id: organization_id, impersonator: impersonator.to_json, access_token: access_token, refresh_token: refresh_token, sealed_session: sealed_session, } end |