Method: OpenIDConnect::ResponseObject::IdToken#to_jwt

Defined in:
lib/openid_connect/response_object/id_token.rb

#to_jwt(key, algorithm = :RS256, &block) ⇒ Object



40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/openid_connect/response_object/id_token.rb', line 40

def to_jwt(key, algorithm = :RS256, &block)
  hash_length = algorithm.to_s[2, 3].to_i
  if access_token
    token = case access_token
    when Rack::OAuth2::AccessToken
      access_token.access_token
    else
      access_token
    end
    self.at_hash = left_half_hash_of token, hash_length
  end
  if code
    self.c_hash = left_half_hash_of code, hash_length
  end
  super
end