Class: FdxV660Api::FdxJwtProfile

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/fdx_jwt_profile.rb

Overview

FDX-extended JWT Profile enabling transport of ConsentGrant details in OAuth access_token. Claim names and values are compliant with IETF specification for JSON Web Token (JWT)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(iss:, sub:, aud:, exp:, scope:, fdx_consent_id:, iat: SKIP, nbf: SKIP, jti: SKIP, client_id: SKIP, additional_properties: nil) ⇒ FdxJwtProfile

Returns a new instance of FdxJwtProfile.



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/fdx_v660_api/models/fdx_jwt_profile.rb', line 92

def initialize(iss:, sub:, aud:, exp:, scope:, fdx_consent_id:, iat: SKIP,
               nbf: SKIP, jti: SKIP, client_id: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @iss = iss
  @sub = sub
  @aud = aud
  @exp = exp
  @iat = iat unless iat == SKIP
  @nbf = nbf unless nbf == SKIP
  @jti = jti unless jti == SKIP
  @client_id = client_id unless client_id == SKIP
  @scope = scope
  @fdx_consent_id = fdx_consent_id
  @additional_properties = additional_properties
end

Instance Attribute Details

#audString

Identifies the relevant Consent party (Data Recipient)

Returns:

  • (String)


24
25
26
# File 'lib/fdx_v660_api/models/fdx_jwt_profile.rb', line 24

def aud
  @aud
end

#client_idString

Identifies the relevant OAuth Client if not the same entity as the audience (intermediary)

Returns:

  • (String)


48
49
50
# File 'lib/fdx_v660_api/models/fdx_jwt_profile.rb', line 48

def client_id
  @client_id
end

#expFloat

Expiration time of the token, formatted as NumericDate as defined by JSON Web Token (JWT)

Returns:

  • (Float)


29
30
31
# File 'lib/fdx_v660_api/models/fdx_jwt_profile.rb', line 29

def exp
  @exp
end

Space-delimited array of FDX consentIds as #/components/schemas/ConsentId an empty array is acceptable and may be necessary in some implementations

Returns:

  • (String)


59
60
61
# File 'lib/fdx_v660_api/models/fdx_jwt_profile.rb', line 59

def fdx_consent_id
  @fdx_consent_id
end

#iatFloat

Issuance time of the token, formatted as NumericDate as defined by JSON Web Token (JWT)

Returns:

  • (Float)


34
35
36
# File 'lib/fdx_v660_api/models/fdx_jwt_profile.rb', line 34

def iat
  @iat
end

#issString

Identifies the relevant Consent party (Data Provider)

Returns:

  • (String)


16
17
18
# File 'lib/fdx_v660_api/models/fdx_jwt_profile.rb', line 16

def iss
  @iss
end

#jtiString

Unique identifier for the token

Returns:

  • (String)


43
44
45
# File 'lib/fdx_v660_api/models/fdx_jwt_profile.rb', line 43

def jti
  @jti
end

#nbfFloat

Not-before time of the token, formatted as NumericDate as defined by JSON Web Token (JWT)

Returns:

  • (Float)


39
40
41
# File 'lib/fdx_v660_api/models/fdx_jwt_profile.rb', line 39

def nbf
  @nbf
end

#scopeString

Space-delimited array of scopes from FdxOauthScope plus openid and/or offline_access. Other (private) scopes may be also included.

Returns:

  • (String)


53
54
55
# File 'lib/fdx_v660_api/models/fdx_jwt_profile.rb', line 53

def scope
  @scope
end

#subString

Identifies the relevant End User using customerId

Returns:

  • (String)


20
21
22
# File 'lib/fdx_v660_api/models/fdx_jwt_profile.rb', line 20

def sub
  @sub
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/fdx_v660_api/models/fdx_jwt_profile.rb', line 112

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  iss = hash.key?('iss') ? hash['iss'] : nil
  sub = hash.key?('sub') ? hash['sub'] : nil
  aud = hash.key?('aud') ? hash['aud'] : nil
  exp = hash.key?('exp') ? hash['exp'] : nil
  scope = hash.key?('scope') ? hash['scope'] : nil
  fdx_consent_id = hash.key?('fdxConsentId') ? hash['fdxConsentId'] : nil
  iat = hash.key?('iat') ? hash['iat'] : SKIP
  nbf = hash.key?('nbf') ? hash['nbf'] : SKIP
  jti = hash.key?('jti') ? hash['jti'] : SKIP
  client_id = hash.key?('client_id') ? hash['client_id'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  FdxJwtProfile.new(iss: iss,
                    sub: sub,
                    aud: aud,
                    exp: exp,
                    scope: scope,
                    fdx_consent_id: fdx_consent_id,
                    iat: iat,
                    nbf: nbf,
                    jti: jti,
                    client_id: client_id,
                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/fdx_v660_api/models/fdx_jwt_profile.rb', line 62

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['iss'] = 'iss'
  @_hash['sub'] = 'sub'
  @_hash['aud'] = 'aud'
  @_hash['exp'] = 'exp'
  @_hash['iat'] = 'iat'
  @_hash['nbf'] = 'nbf'
  @_hash['jti'] = 'jti'
  @_hash['client_id'] = 'client_id'
  @_hash['scope'] = 'scope'
  @_hash['fdx_consent_id'] = 'fdxConsentId'
  @_hash
end

.nullablesObject

An array for nullable fields



88
89
90
# File 'lib/fdx_v660_api/models/fdx_jwt_profile.rb', line 88

def self.nullables
  []
end

.optionalsObject

An array for optional fields



78
79
80
81
82
83
84
85
# File 'lib/fdx_v660_api/models/fdx_jwt_profile.rb', line 78

def self.optionals
  %w[
    iat
    nbf
    jti
    client_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



157
158
159
160
161
162
163
# File 'lib/fdx_v660_api/models/fdx_jwt_profile.rb', line 157

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} iss: #{@iss.inspect}, sub: #{@sub.inspect}, aud: #{@aud.inspect}, exp:"\
  " #{@exp.inspect}, iat: #{@iat.inspect}, nbf: #{@nbf.inspect}, jti: #{@jti.inspect},"\
  " client_id: #{@client_id.inspect}, scope: #{@scope.inspect}, fdx_consent_id:"\
  " #{@fdx_consent_id.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



149
150
151
152
153
154
# File 'lib/fdx_v660_api/models/fdx_jwt_profile.rb', line 149

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} iss: #{@iss}, sub: #{@sub}, aud: #{@aud}, exp: #{@exp}, iat: #{@iat}, nbf:"\
  " #{@nbf}, jti: #{@jti}, client_id: #{@client_id}, scope: #{@scope}, fdx_consent_id:"\
  " #{@fdx_consent_id}, additional_properties: #{@additional_properties}>"
end