Class: OmniauthOidc::ResponseObjects::IdToken

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

Overview

Represents an OIDC ID Token with claims

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ IdToken

Returns a new instance of IdToken.



10
11
12
# File 'lib/omniauth/oidc/response_objects.rb', line 10

def initialize(attributes = {})
  @raw_attributes = attributes.is_a?(Hash) ? attributes : attributes.to_h
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object

Allow method-style access to claims



39
40
41
42
43
# File 'lib/omniauth/oidc/response_objects.rb', line 39

def method_missing(method_name, *args)
  return raw_attributes[method_name.to_s] if raw_attributes.key?(method_name.to_s)

  super
end

Instance Attribute Details

#raw_attributesObject (readonly)

Returns the value of attribute raw_attributes.



8
9
10
# File 'lib/omniauth/oidc/response_objects.rb', line 8

def raw_attributes
  @raw_attributes
end

Instance Method Details

#audObject



22
23
24
# File 'lib/omniauth/oidc/response_objects.rb', line 22

def aud
  raw_attributes["aud"]
end

#expObject



26
27
28
# File 'lib/omniauth/oidc/response_objects.rb', line 26

def exp
  raw_attributes["exp"]
end

#iatObject



30
31
32
# File 'lib/omniauth/oidc/response_objects.rb', line 30

def iat
  raw_attributes["iat"]
end

#issObject



18
19
20
# File 'lib/omniauth/oidc/response_objects.rb', line 18

def iss
  raw_attributes["iss"]
end

#nonceObject



34
35
36
# File 'lib/omniauth/oidc/response_objects.rb', line 34

def nonce
  raw_attributes["nonce"]
end

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


45
46
47
# File 'lib/omniauth/oidc/response_objects.rb', line 45

def respond_to_missing?(method_name, include_private = false)
  raw_attributes.key?(method_name.to_s) || super
end

#subObject



14
15
16
# File 'lib/omniauth/oidc/response_objects.rb', line 14

def sub
  raw_attributes["sub"]
end