Class: OmniauthOidc::ResponseObjects::AccessToken

Inherits:
Object
  • Object
show all
Defined in:
lib/omniauth/oidc/response_objects.rb

Overview

Represents an OAuth2 Access Token

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AccessToken

Returns a new instance of AccessToken.



155
156
157
158
159
160
161
162
# File 'lib/omniauth/oidc/response_objects.rb', line 155

def initialize(attributes = {})
  @access_token = attributes["access_token"] || attributes[:access_token]
  @token_type = attributes["token_type"] || attributes[:token_type]
  @expires_in = attributes["expires_in"] || attributes[:expires_in]
  @refresh_token = attributes["refresh_token"] || attributes[:refresh_token]
  @scope = attributes["scope"] || attributes[:scope]
  @id_token = attributes["id_token"] || attributes[:id_token]
end

Instance Attribute Details

#access_tokenObject (readonly)

Returns the value of attribute access_token.



153
154
155
# File 'lib/omniauth/oidc/response_objects.rb', line 153

def access_token
  @access_token
end

#expires_inObject (readonly)

Returns the value of attribute expires_in.



153
154
155
# File 'lib/omniauth/oidc/response_objects.rb', line 153

def expires_in
  @expires_in
end

#id_tokenObject (readonly)

Returns the value of attribute id_token.



153
154
155
# File 'lib/omniauth/oidc/response_objects.rb', line 153

def id_token
  @id_token
end

#refresh_tokenObject (readonly)

Returns the value of attribute refresh_token.



153
154
155
# File 'lib/omniauth/oidc/response_objects.rb', line 153

def refresh_token
  @refresh_token
end

#scopeObject (readonly)

Returns the value of attribute scope.



153
154
155
# File 'lib/omniauth/oidc/response_objects.rb', line 153

def scope
  @scope
end

#token_typeObject (readonly)

Returns the value of attribute token_type.



153
154
155
# File 'lib/omniauth/oidc/response_objects.rb', line 153

def token_type
  @token_type
end

Instance Method Details

#to_hObject



164
165
166
167
168
169
170
171
172
173
# File 'lib/omniauth/oidc/response_objects.rb', line 164

def to_h
  {
    "access_token" => access_token,
    "token_type" => token_type,
    "expires_in" => expires_in,
    "refresh_token" => refresh_token,
    "scope" => scope,
    "id_token" => id_token
  }.compact
end