Module: Doorkeeper::OpenidConnect::OAuth::TokenResponse

Defined in:
lib/doorkeeper/openid_connect/oauth/token_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#id_tokenObject

Returns the value of attribute id_token.



7
8
9
# File 'lib/doorkeeper/openid_connect/oauth/token_response.rb', line 7

def id_token
  @id_token
end

Instance Method Details

#bodyObject



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/doorkeeper/openid_connect/oauth/token_response.rb', line 9

def body
  if token.includes_scope? "openid"
    # `id_token` is preset by the flows that carry a nonce (the
    # authorization code and password grants). Grants without one —
    # e.g. refresh_token — reach here with it unset, so build a
    # nonce-less ID Token on the fly.
    id_token = self.id_token || Doorkeeper::OpenidConnect::IdToken.new(token)

    super
      .merge(id_token: id_token.as_jws_token)
      .reject { |_, value| value.blank? }
  else
    super
  end
end