authlete 1.0.24 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (160) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +2 -1
  3. data/Makefile +40 -0
  4. data/Rakefile +5 -0
  5. data/authlete.gemspec +2 -2
  6. data/lib/authlete.rb +28 -9
  7. data/lib/authlete/api.rb +146 -321
  8. data/lib/authlete/authentication-server.rb +2 -2
  9. data/lib/authlete/exception.rb +14 -15
  10. data/lib/authlete/model/base.rb +30 -0
  11. data/lib/authlete/model/client-extension.rb +17 -119
  12. data/lib/authlete/model/client.rb +196 -345
  13. data/lib/authlete/model/hashable.rb +13 -33
  14. data/lib/authlete/model/named-uri.rb +13 -74
  15. data/lib/authlete/model/pair.rb +13 -74
  16. data/lib/authlete/model/param-initializer.rb +45 -0
  17. data/lib/authlete/model/property.rb +15 -85
  18. data/lib/authlete/model/request/authentication-callback-request.rb +63 -55
  19. data/lib/authlete/model/request/authorization-fail-request.rb +14 -75
  20. data/lib/authlete/model/request/authorization-issue-request.rb +38 -119
  21. data/lib/authlete/model/request/authorization-request.rb +8 -73
  22. data/lib/authlete/model/request/backchannel-authentication-complete-request.rb +97 -0
  23. data/lib/authlete/model/request/backchannel-authentication-fail-request.rb +55 -0
  24. data/lib/authlete/model/request/backchannel-authentication-issue-request.rb +37 -0
  25. data/lib/authlete/model/request/backchannel-authentication-request.rb +63 -0
  26. data/lib/authlete/model/request/base.rb +26 -0
  27. data/lib/authlete/model/request/client-authorization-delete-request.rb +7 -93
  28. data/lib/authlete/model/request/client-authorization-get-list-request.rb +17 -89
  29. data/lib/authlete/model/request/client-authorization-update-request.rb +11 -86
  30. data/lib/authlete/model/request/client-registration-request.rb +49 -0
  31. data/lib/authlete/model/request/client-secret-update-request.rb +7 -89
  32. data/lib/authlete/model/request/developer-authentication-callback-request.rb +40 -43
  33. data/lib/authlete/model/request/device-authorization-request.rb +63 -0
  34. data/lib/authlete/model/request/device-complete-request.rb +99 -0
  35. data/lib/authlete/model/request/device-verification-request.rb +40 -0
  36. data/lib/authlete/model/request/granted-scopes-request.rb +8 -74
  37. data/lib/authlete/model/request/introspection-request.rb +24 -83
  38. data/lib/authlete/model/request/pushed-auth-req-request.rb +64 -0
  39. data/lib/authlete/model/request/revocation-request.rb +14 -88
  40. data/lib/authlete/model/request/standard-introspection-request.rb +8 -73
  41. data/lib/authlete/model/request/token-create-request.rb +52 -183
  42. data/lib/authlete/model/request/token-fail-request.rb +12 -74
  43. data/lib/authlete/model/request/token-issue-request.rb +22 -80
  44. data/lib/authlete/model/request/token-request.rb +44 -81
  45. data/lib/authlete/model/request/token-update-request.rb +35 -121
  46. data/lib/authlete/model/request/user-info-issue-request.rb +14 -80
  47. data/lib/authlete/model/request/user-info-request.rb +25 -70
  48. data/lib/authlete/model/response/access-token.rb +96 -0
  49. data/lib/authlete/model/response/authentication-callback-response.rb +24 -19
  50. data/lib/authlete/model/response/authorization-fail-response.rb +13 -15
  51. data/lib/authlete/model/response/authorization-issue-response.rb +29 -32
  52. data/lib/authlete/model/response/authorization-response.rb +97 -123
  53. data/lib/authlete/model/response/authorized-client-list-response.rb +37 -0
  54. data/lib/authlete/model/response/backchannel-authentication-complete-response.rb +143 -0
  55. data/lib/authlete/model/response/backchannel-authentication-fail-response.rb +47 -0
  56. data/lib/authlete/model/response/backchannel-authentication-issue-response.rb +63 -0
  57. data/lib/authlete/model/response/backchannel-authentication-response.rb +160 -0
  58. data/lib/authlete/model/response/client-list-response.rb +58 -0
  59. data/lib/authlete/model/response/client-registration-response.rb +50 -0
  60. data/lib/authlete/model/response/client-secret-refresh-response.rb +12 -12
  61. data/lib/authlete/model/response/client-secret-update-response.rb +12 -12
  62. data/lib/authlete/model/response/developer-authentication-callback-response.rb +24 -19
  63. data/lib/authlete/model/response/device-authorization-response.rb +134 -0
  64. data/lib/authlete/model/response/device-complete-response.rb +39 -0
  65. data/lib/authlete/model/response/device-verification-response.rb +96 -0
  66. data/lib/authlete/model/response/granted-scopes-get-response.rb +27 -19
  67. data/lib/authlete/model/response/introspection-response.rb +64 -58
  68. data/lib/authlete/model/response/pushed-auth-req-response.rb +59 -0
  69. data/lib/authlete/model/response/revocation-response.rb +12 -15
  70. data/lib/authlete/model/response/service-list-response.rb +54 -0
  71. data/lib/authlete/model/response/standard-introspection-response.rb +13 -15
  72. data/lib/authlete/model/response/token-create-response.rb +50 -55
  73. data/lib/authlete/model/response/token-fail-response.rb +14 -17
  74. data/lib/authlete/model/response/token-issue-response.rb +49 -62
  75. data/lib/authlete/model/response/token-list-response.rb +64 -0
  76. data/lib/authlete/model/response/token-response.rb +59 -79
  77. data/lib/authlete/model/response/token-update-response.rb +28 -23
  78. data/lib/authlete/model/response/user-info-issue-response.rb +16 -16
  79. data/lib/authlete/model/response/user-info-response.rb +48 -42
  80. data/lib/authlete/model/result.rb +14 -13
  81. data/lib/authlete/model/scope.rb +29 -119
  82. data/lib/authlete/model/service-owner.rb +32 -116
  83. data/lib/authlete/model/service.rb +464 -685
  84. data/lib/authlete/model/sns-credentials.rb +18 -91
  85. data/lib/authlete/model/tagged-value.rb +14 -69
  86. data/lib/authlete/utility.rb +3 -32
  87. data/lib/authlete/version.rb +3 -3
  88. data/test/authlete/model/request/test_authentication-callback-request.rb +100 -0
  89. data/test/authlete/model/request/test_authorization-fail-request.rb +67 -0
  90. data/test/authlete/model/request/test_authorization-issue-request.rb +94 -0
  91. data/test/authlete/model/request/test_authorization-request.rb +57 -0
  92. data/test/authlete/model/request/test_backchannel-authentication-complete-request.rb +102 -0
  93. data/test/authlete/model/request/test_backchannel-authentication-fail-request.rb +71 -0
  94. data/test/authlete/model/request/test_backchannel-authentication-issue-request.rb +57 -0
  95. data/test/authlete/model/request/test_backchannel-authentication-request.rb +75 -0
  96. data/test/authlete/model/request/test_client-authorization-delete-request.rb +57 -0
  97. data/test/authlete/model/request/test_client-authorization-get-list-request.rb +71 -0
  98. data/test/authlete/model/request/test_client-authorization-update-request.rb +63 -0
  99. data/test/authlete/model/request/test_client-registration-request.rb +68 -0
  100. data/test/authlete/model/request/test_device-authorization-request.rb +75 -0
  101. data/test/authlete/model/request/test_device-complete-request.rb +102 -0
  102. data/test/authlete/model/request/test_device-verification-request.rb +57 -0
  103. data/test/authlete/model/request/test_granted-scopes-request.rb +57 -0
  104. data/test/authlete/model/request/test_introspection-request.rb +79 -0
  105. data/test/authlete/model/request/test_pushed-auth-req-request.rb +75 -0
  106. data/test/authlete/model/request/test_revocation-request.rb +67 -0
  107. data/test/authlete/model/request/test_standard-introspection-request.rb +57 -0
  108. data/test/authlete/model/request/test_token-create-request.rb +110 -0
  109. data/test/authlete/model/request/test_token-fail-request.rb +63 -0
  110. data/test/authlete/model/request/test_token-issue-request.rb +70 -0
  111. data/test/authlete/model/request/test_token-request.rb +94 -0
  112. data/test/authlete/model/request/test_token-update-request.rb +82 -0
  113. data/test/authlete/model/request/test_user-info-issue-request.rb +67 -0
  114. data/test/authlete/model/request/test_user-info-request.rb +75 -0
  115. data/test/authlete/model/response/test_access-token.rb +101 -0
  116. data/test/authlete/model/response/test_authorization-fail-response.rb +68 -0
  117. data/test/authlete/model/response/test_authorization-issue-response.rb +92 -0
  118. data/test/authlete/model/response/test_authorization-response.rb +145 -0
  119. data/test/authlete/model/response/test_authorized-client-list-response.rb +83 -0
  120. data/test/authlete/model/response/test_backchannel-authentication-complete-response.rb +132 -0
  121. data/test/authlete/model/response/test_backchannel-authentication-fail-response.rb +68 -0
  122. data/test/authlete/model/response/test_backchannel-authentication-issue-response.rb +80 -0
  123. data/test/authlete/model/response/test_backchannel-authentication-response.rb +156 -0
  124. data/test/authlete/model/response/test_client-list-response.rb +79 -0
  125. data/test/authlete/model/response/test_client-secret-refresh-response.rb +68 -0
  126. data/test/authlete/model/response/test_client-secret-update-response.rb +68 -0
  127. data/test/authlete/model/response/test_device-authorization-response.rb +140 -0
  128. data/test/authlete/model/response/test_device-complete-response.rb +64 -0
  129. data/test/authlete/model/response/test_device-verification-response.rb +112 -0
  130. data/test/authlete/model/response/test_granted-scopes-get-response.rb +84 -0
  131. data/test/authlete/model/response/test_introspection-response.rb +127 -0
  132. data/test/authlete/model/response/test_pushed-auth-req-response.rb +76 -0
  133. data/test/authlete/model/response/test_revocation-response.rb +68 -0
  134. data/test/authlete/model/response/test_service-list-response.rb +72 -0
  135. data/test/authlete/model/response/test_standard-introspection-response.rb +68 -0
  136. data/test/authlete/model/response/test_token-create-response.rb +107 -0
  137. data/test/authlete/model/response/test_token-fail-response.rb +68 -0
  138. data/test/authlete/model/response/test_token-issue-response.rb +127 -0
  139. data/test/authlete/model/response/test_token-list-response.rb +84 -0
  140. data/test/authlete/model/response/test_token-response.rb +147 -0
  141. data/test/authlete/model/response/test_token-update-response.rb +87 -0
  142. data/test/authlete/model/response/test_user-info-issue-response.rb +68 -0
  143. data/test/authlete/model/response/test_user-info-response.rb +107 -0
  144. data/test/authlete/model/test_client-extension.rb +95 -0
  145. data/test/authlete/model/test_client.rb +461 -0
  146. data/test/authlete/model/test_named-uri.rb +85 -0
  147. data/test/authlete/model/test_pair.rb +85 -0
  148. data/test/authlete/model/test_property.rb +90 -0
  149. data/test/authlete/model/test_result.rb +68 -0
  150. data/test/authlete/model/test_scope.rb +106 -0
  151. data/test/authlete/model/test_service-owner.rb +80 -0
  152. data/test/authlete/model/test_service.rb +614 -0
  153. data/test/authlete/model/test_sns-credentials.rb +88 -0
  154. data/test/authlete/model/test_tagged-value.rb +83 -0
  155. data/test/authlete/test_exception.rb +70 -0
  156. metadata +169 -9
  157. data/lib/authlete/model/client-list.rb +0 -129
  158. data/lib/authlete/model/response/client-authorization-get-list-response.rb +0 -60
  159. data/lib/authlete/model/response/service-creatable-response.rb +0 -51
  160. data/lib/authlete/model/service-list.rb +0 -128
@@ -1,6 +1,6 @@
1
1
  # :nodoc:
2
2
  #
3
- # Copyright (C) 2014-2018 Authlete, Inc.
3
+ # Copyright (C) 2014-2020 Authlete, Inc.
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -227,4 +227,4 @@ module Authlete
227
227
  '/authentication'
228
228
  end
229
229
  end
230
- end
230
+ end
@@ -1,6 +1,6 @@
1
1
  # :nodoc:
2
2
  #
3
- # Copyright (C) 2014-2018 Authlete, Inc.
3
+ # Copyright (C) 2014-2020 Authlete, Inc.
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -17,31 +17,30 @@
17
17
 
18
18
  module Authlete
19
19
  class Exception < StandardError
20
- include Authlete::Utility
20
+ include Authlete::ParamInitializer
21
21
 
22
- # The error message.
23
22
  attr_accessor :message
24
23
 
25
- # The HTTP status code of the error.
26
24
  attr_accessor :statusCode
27
25
  alias_method :status_code, :statusCode
28
26
  alias_method :status_code=, :statusCode=
29
27
 
30
- # The result of the API call.
31
28
  attr_accessor :result
32
29
 
33
30
  private
34
31
 
35
- def initialize(hash = {})
36
- # The error message from RestClient or the other general exceptions.
37
- @message = extract_value(hash, :message)
38
-
39
- # HTTP status code.
40
- @statusCode = extract_integer_value(hash, :statusCode)
32
+ def defaults
33
+ {
34
+ message: nil,
35
+ statusCode: 0,
36
+ result: nil
37
+ }
38
+ end
41
39
 
42
- # Set result.
43
- result = extract_value(hash, :result)
44
- @result = result.nil? ? nil : Authlete::Model::Result.new(result)
40
+ def set_params(hash)
41
+ @message = hash[:message]
42
+ @statusCode = hash[:statusCode]
43
+ @result = Authlete::Model::Result.parse(hash[:result])
45
44
  end
46
45
 
47
46
  public
@@ -67,4 +66,4 @@ module Authlete
67
66
  self.name
68
67
  end
69
68
  end
70
- end
69
+ end
@@ -0,0 +1,30 @@
1
+ # :nodoc:
2
+ #
3
+ # Copyright (C) 2014-2020 Authlete, Inc.
4
+ #
5
+ # Licensed under the Apache License, Version 2.0 (the "License");
6
+ # you may not use this file except in compliance with the License.
7
+ # You may obtain a copy of the License at
8
+ #
9
+ # http://www.apache.org/licenses/LICENSE-2.0
10
+ #
11
+ # Unless required by applicable law or agreed to in writing, software
12
+ # distributed under the License is distributed on an "AS IS" BASIS,
13
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ # See the License for the specific language governing permissions and
15
+ # limitations under the License.
16
+
17
+
18
+ module Authlete
19
+ module Model
20
+ class Base
21
+ include Authlete::ParamInitializer
22
+
23
+ public
24
+
25
+ def self.parse(hash)
26
+ hash.kind_of?(Hash) ? self.new(hash) : nil
27
+ end
28
+ end
29
+ end
30
+ end
@@ -1,6 +1,6 @@
1
1
  # :nodoc:
2
2
  #
3
- # Copyright (C) 2014-2018 Authlete, Inc.
3
+ # Copyright (C) 2014-2020 Authlete, Inc.
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -15,146 +15,44 @@
15
15
  # limitations under the License.
16
16
 
17
17
 
18
- require 'set'
19
-
20
-
21
18
  module Authlete
22
19
  module Model
23
- class ClientExtension < Authlete::Model::Hashable
24
- include Authlete::Utility
25
- # The set of scopes that a client application is allowed to request.
26
- # (String array)
20
+ class ClientExtension < Authlete::Model::Base
21
+ include Authlete::Model::Hashable
22
+
27
23
  attr_accessor :requestableScopes
28
24
  alias_method :requestable_scopes, :requestableScopes
29
25
  alias_method :requestable_scopes=, :requestableScopes=
30
26
 
31
- # The flag to show whether a client application can only request
32
- # the set of scopes that it is allowed to request or it can request
33
- # all of the scopes that the service supports. (Boolean)
34
27
  attr_accessor :requestableScopesEnabled
35
28
  alias_method :requestable_scopes_enabled, :requestableScopesEnabled
36
29
  alias_method :requestable_scopes_enabled=, :requestableScopesEnabled=
37
30
 
38
- # The duration of access tokens in seconds that are issued to a client.
39
- # (Integer)
40
31
  attr_accessor :accessTokenDuration
41
32
  alias_method :access_token_duration, :accessTokenDuration
42
33
  alias_method :access_token_duration=, :accessTokenDuration=
43
34
 
44
- # The duration of refresh tokens in seconds that are issued to a client.
45
- # (Integer)
46
35
  attr_accessor :refreshTokenDuration
47
36
  alias_method :refresh_token_duration, :refreshTokenDuration
48
37
  alias_method :refresh_token_duration=, :refreshTokenDuration=
49
38
 
50
39
  private
51
40
 
52
- # Integer attributes.
53
- INTEGER_ATTRIBUTES = ::Set.new([
54
- :accessTokenDuration, :refreshTokenDuration
55
- ])
56
-
57
- # Boolean attributes.
58
- BOOLEAN_ATTRIBUTES = ::Set.new([
59
- :requestableScopesEnabled
60
- ])
61
-
62
- # String array attributes.
63
- STRING_ARRAY_ATTRIBUTES = ::Set.new([
64
- :requestableScopes
65
- ])
66
-
67
- # Mapping from snake cases to camel cases.
68
- SNAKE_TO_CAMEL = {
69
- :requestable_scopes => :requestableScopes,
70
- :requestable_scopes_enabled => :requestableScopesEnabled,
71
- :access_token_duration => :accessTokenDuration,
72
- :refresh_token_duration => :refreshTokenDuration
73
- }
74
-
75
- # The constructor
76
- def initialize(hash = nil)
77
- # Set default values to integer attributes.
78
- INTEGER_ATTRIBUTES.each do |attr|
79
- send("#{attr}=", 0)
80
- end
81
-
82
- # Set default values to boolean attributes.
83
- BOOLEAN_ATTRIBUTES.each do |attr|
84
- send("#{attr}=", false)
85
- end
86
-
87
- # Set default values to string array attributes.
88
- STRING_ARRAY_ATTRIBUTES.each do |attr|
89
- send("#{attr}=", nil)
90
- end
91
-
92
- # Set attribute values using the given hash.
93
- authlete_model_update(hash)
94
- end
95
-
96
- def authlete_model_convert_key(key)
97
- key = key.to_sym
98
-
99
- # Convert snakecase to camelcase, if necessary.
100
- if SNAKE_TO_CAMEL.has_key?(key)
101
- key = SNAKE_TO_CAMEL[key]
102
- end
103
-
104
- key
41
+ def defaults
42
+ {
43
+ requestableScopes: nil,
44
+ requestableScopesEnabled: false,
45
+ accessTokenDuration: 0,
46
+ refreshTokenDuration: 0
47
+ }
105
48
  end
106
49
 
107
- def authlete_model_simple_attribute?(key)
108
- INTEGER_ATTRIBUTES.include?(key) or
109
- BOOLEAN_ATTRIBUTES.include?(key) or
110
- STRING_ARRAY_ATTRIBUTES.include?(key)
111
- end
112
-
113
- def authlete_model_update(hash)
114
- return if hash.nil?
115
-
116
- hash.each do |key, value|
117
- key = authlete_model_convert_key(key)
118
-
119
- if authlete_model_simple_attribute?(key)
120
- send("#{key}=", value)
121
- end
122
- end
123
-
124
- self
125
- end
126
-
127
- public
128
-
129
- # Construct an instance from the given hash.
130
- #
131
- # If the given argument is nil or is not a Hash, nil is returned.
132
- # Otherwise, ClientList.new(hash) is returned.
133
- def self.parse(hash)
134
- if hash.nil? or (hash.kind_of?(Hash) == false)
135
- return nil
136
- end
137
-
138
- return ClientExtension.new(hash)
139
- end
140
-
141
- # Convert this object into a hash.
142
- def to_hash
143
- hash = {}
144
-
145
- instance_variables.each do |var|
146
- key = var.to_s.delete("@").to_sym
147
- val = instance_variable_get(var)
148
-
149
- if authlete_model_simple_attribute?(key) or val.nil?
150
- hash[key] = val
151
- elsif val.kind_of?(Array)
152
- hash[key] = val.map { |element| element.to_hash }
153
- end
154
- end
155
-
156
- hash
50
+ def set_params(hash)
51
+ @requestableScopes = hash[:requestableScopes]
52
+ @requestableScopesEnabled = hash[:requestableScopesEnabled]
53
+ @accessTokenDuration = hash[:accessTokenDuration]
54
+ @refreshTokenDuration = hash[:refreshTokenDuration]
157
55
  end
158
56
  end
159
57
  end
160
- end
58
+ end
@@ -1,6 +1,6 @@
1
1
  # :nodoc:
2
2
  #
3
- # Copyright (C) 2014-2018 Authlete, Inc.
3
+ # Copyright (C) 2014-2020 Authlete, Inc.
4
4
  #
5
5
  # Licensed under the Apache License, Version 2.0 (the "License");
6
6
  # you may not use this file except in compliance with the License.
@@ -15,589 +15,440 @@
15
15
  # limitations under the License.
16
16
 
17
17
 
18
- require 'set'
19
-
20
-
21
18
  module Authlete
22
19
  module Model
23
- class Client < Authlete::Model::Hashable
20
+ class Client < Authlete::Model::Base
21
+ include Authlete::Model::Hashable
24
22
  include Authlete::Utility
25
- # The sequential number of the client application. (Integer)
23
+
26
24
  attr_accessor :number
27
25
 
28
- # The sequential number of the service of the client application.
29
- # (Integer)
30
26
  attr_accessor :serviceNumber
31
27
  alias_method :service_number, :serviceNumber
32
28
  alias_method :service_number=, :serviceNumber=
33
29
 
34
- # The developer of the client application. (String)
35
30
  attr_accessor :developer
36
31
 
37
- # The client ID. (Integer)
38
32
  attr_accessor :clientId
39
33
  alias_method :client_id, :clientId
40
34
  alias_method :client_id=, :clientId=
41
35
 
42
- # Alias of client ID. (String)
43
36
  attr_accessor :clientIdAlias
44
37
  alias_method :client_id_alias, :clientIdAlias
45
38
  alias_method :client_id_alias=, :clientIdAlias=
46
39
 
47
- # The flag which indicates whether the 'Client ID Alias' feature
48
- # is enabled or not. (Boolean)
49
40
  attr_accessor :clientIdAliasEnabled
50
41
  alias_method :client_id_alias_enabled, :clientIdAliasEnabled
51
42
  alias_method :client_id_alias_enabled=, :clientIdAliasEnabled=
52
43
 
53
- # The client secret. (String)
54
44
  attr_accessor :clientSecret
55
45
  alias_method :client_secret, :clientSecret
56
46
  alias_method :client_secret=, :clientSecret=
57
47
 
58
- # The client type. (String)
59
48
  attr_accessor :clientType
60
49
  alias_method :client_type, :clientType
61
50
  alias_method :client_type=, :clientType=
62
51
 
63
- # Redirect URIs that the client application uses to receive a response
64
- # from the authorization endpoint. (URI array)
65
52
  attr_accessor :redirectUris
66
53
  alias_method :redirect_uris, :redirectUris
67
54
  alias_method :redirect_uris=, :redirectUris=
68
55
 
69
- # A string array of response types which the client application declares
70
- # that it will restrict itself to using (String array)
71
56
  attr_accessor :responseTypes
72
57
  alias_method :response_types, :responseTypes
73
58
  alias_method :response_types=, :responseTypes=
74
59
 
75
- # A string array of grant types which the client application declares
76
- # that it will restrict itself to using. (String array)
77
60
  attr_accessor :grantTypes
78
61
  alias_method :grant_types, :grantTypes
79
62
  alias_method :grant_types=, :grantTypes=
80
63
 
81
- # The application type. (String)
82
64
  attr_accessor :applicationType
83
65
  alias_method :application_type, :applicationType
84
66
  alias_method :application_type=, :applicationType=
85
67
 
86
- # An array of email addresses of people responsible for the client application.
87
- # (String array)
88
68
  attr_accessor :contacts
89
69
 
90
- # The name of the client application. (String)
91
70
  attr_accessor :clientName
92
71
  alias_method :client_name, :clientName
93
72
  alias_method :client_name=, :clientName=
94
73
 
95
- # Client names with language tags. (TaggedValue array)
96
74
  attr_accessor :clientNames
97
75
  alias_method :client_names, :clientNames
98
76
  alias_method :client_names=, :clientNames=
99
77
 
100
- # The URL pointing to the logo image of the client application. (URI)
101
78
  attr_accessor :logoUri
102
79
  alias_method :logo_uri, :logoUri
103
80
  alias_method :logo_uri=, :logoUri=
104
81
 
105
- # Logo image URLs with language tags. (TaggedValue array)
106
82
  attr_accessor :logoUris
107
83
  alias_method :logo_uris, :logoUris
108
84
  alias_method :logo_uris=, :logoUris=
109
85
 
110
- # The URL pointing to the home page of the client application. (URI)
111
86
  attr_accessor :clientUri
112
87
  alias_method :client_uri, :clientUri
113
88
  alias_method :client_uri=, :clientUri=
114
89
 
115
- # Home page URLs with language tags. (TaggedValue array)
116
90
  attr_accessor :clientUris
117
91
  alias_method :client_uris, :clientUris
118
92
  alias_method :client_uris=, :clientUris=
119
93
 
120
- # The URL pointing to the page which describes the policy
121
- # as to how end-users' profile data are used. (URI)
122
94
  attr_accessor :policyUri
123
95
  alias_method :policy_uri, :policyUri
124
96
  alias_method :policy_uri=, :policyUri=
125
97
 
126
- # URLs of policy pages with language tags. (TaggedValue array)
127
98
  attr_accessor :policyUris
128
99
  alias_method :policy_uris, :policyUris
129
100
  alias_method :policy_uris=, :policyUris=
130
101
 
131
- # The URL pointing to the "Terms Of Service" page. (URI)
132
102
  attr_accessor :tosUri
133
103
  alias_method :tos_uri, :tosUri
134
104
  alias_method :tos_uri=, :tosUri=
135
105
 
136
- # URLs of "Terms Of Service" pages with language tags.
137
- # (TaggedValue array)
138
106
  attr_accessor :tosUris
139
107
  alias_method :tos_uris, :tosUris
140
108
  alias_method :tos_uris=, :tosUris=
141
109
 
142
- # The URL pointing to the JWK Set of the client application. (URI)
143
110
  attr_accessor :jwksUri
144
111
  alias_method :jwks_uri, :jwksUri
145
112
  alias_method :jwks_uri=, :jwksUri=
146
113
 
147
- # The content of the JWK Set of the client application. (String)
148
114
  attr_accessor :jwks
149
115
 
150
- # The DN of the certificate used in mutual client authentication
151
- attr_accessor :tlsClientAuthSubjectDn
152
- alias_method :tls_client_auth_subject_dn, :tlsClientAuthSubjectDn
153
- alias_method :tls_client_auth_subject_dn=, :tlsClientAuthSubjectDn=
116
+ attr_accessor :derivedSectorIdentifier
117
+ alias_method :derived_sector_identifier, :derivedSectorIdentifier
118
+ alias_method :derived_sector_identifier=, :derivedSectorIdentifier=
154
119
 
155
- # The sector identifier which is a URL starting with https. (URI)
156
- attr_accessor :sectorIdentifier
157
- alias_method :sector_identifier, :sectorIdentifier
158
- alias_method :sector_identifier=, :sectorIdentifier=
120
+ attr_accessor :sectorIdentifierUri
121
+ alias_method :sector_identifier_uri, :sectorIdentifierUri
122
+ alias_method :sector_identifier_uri=, :sectorIdentifierUri=
159
123
 
160
- # The subject type that the client application requests. (URI)
161
124
  attr_accessor :subjectType
162
125
  alias_method :subject_type, :subjectType
163
126
  alias_method :subject_type=, :subjectType=
164
127
 
165
- # The value of +alg+ header parameter of JWS that the client application
166
- # requires the service to use for signing an ID token. (String)
167
128
  attr_accessor :idTokenSignAlg
168
129
  alias_method :id_token_sign_alg, :idTokenSignAlg
169
130
  alias_method :id_token_sign_alg=, :idTokenSignAlg=
170
131
 
171
- # The value of +alg+ header parameter of JWE that the client application
172
- # requires the service to use for encrypting an ID token. (String)
173
132
  attr_accessor :idTokenEncryptionAlg
174
133
  alias_method :id_token_encryption_alg, :idTokenEncryptionAlg
175
134
  alias_method :id_token_encryption_alg=, :idTokenEncryptionAlg=
176
135
 
177
- # The value of +enc+ header parameter of JWE that the client application
178
- # requires the service to use for encrypting an ID token. (String)
179
136
  attr_accessor :idTokenEncryptionEnc
180
137
  alias_method :id_token_encryption_enc, :idTokenEncryptionEnc
181
138
  alias_method :id_token_encryption_enc=, :idTokenEncryptionEnc=
182
139
 
183
- # The value of +alg+ header parameter of JWS that the client application
184
- # requires the service to use for signing the JWT returned from the user
185
- # info endpoint. One of the values listed in JWS Algorithm. (String)
186
140
  attr_accessor :userInfoSignAlg
187
141
  alias_method :user_info_sign_alg, :userInfoSignAlg
188
142
  alias_method :user_info_sign_alg=, :userInfoSignAlg=
189
143
 
190
- # The value of +alg+ header parameter of JWE that the client application
191
- # requires the service to use for encrypting the JWT returned from
192
- # the user info endpoint. (String)
193
144
  attr_accessor :userInfoEncryptionAlg
194
145
  alias_method :user_info_encryption_alg, :userInfoEncryptionAlg
195
146
  alias_method :user_info_encryption_alg=, :userInfoEncryptionAlg=
196
147
 
197
- # The value of +enc+ header parameter of JWE that the client application
198
- # requires the service to use for encrypting the JWT returned from
199
- # the user info endpoint. (String)
200
148
  attr_accessor :userInfoEncryptionEnc
201
149
  alias_method :user_info_encryption_enc, :userInfoEncryptionEnc
202
150
  alias_method :user_info_encryption_enc=, :userInfoEncryptionEnc=
203
151
 
204
- # The value of +alg+ header parameter of JWS that the client application
205
- # uses for signing a request object. (String)
206
152
  attr_accessor :requestSignAlg
207
153
  alias_method :request_sign_alg, :requestSignAlg
208
154
  alias_method :request_sign_alg=, :requestSignAlg=
209
155
 
210
- # The value of +alg+ header parameter of JWE that the client application
211
- # uses for encrypting a request object. (String)
212
156
  attr_accessor :requestEncryptionAlg
213
157
  alias_method :request_encryption_alg, :requestEncryptionAlg
214
158
  alias_method :request_encryption_alg=, :requestEncryptionAlg=
215
159
 
216
- # The value of +enc+ header parameter of JWE that the client application
217
- # uses for encrypting a request object. (String)
218
160
  attr_accessor :requestEncryptionEnc
219
161
  alias_method :request_encryption_enc, :requestEncryptionEnc
220
162
  alias_method :request_encryption_enc=, :requestEncryptionEnc=
221
163
 
222
- # The client authentication method that the client application
223
- # declares that it uses at the token endpoint. (String)
224
164
  attr_accessor :tokenAuthMethod
225
165
  alias_method :token_auth_method, :tokenAuthMethod
226
166
  alias_method :token_auth_method=, :tokenAuthMethod=
227
167
 
228
- # The value of +alg+ header parameter of JWS which is used
229
- # for client authentication at the token endpoint. (String)
230
168
  attr_accessor :tokenAuthSignAlg
231
169
  alias_method :token_auth_sign_alg, :tokenAuthSignAlg
232
170
  alias_method :token_auth_sign_alg=, :tokenAuthSignAlg=
233
171
 
234
- # The default maximum authentication age in seconds. (Integer)
235
172
  attr_accessor :defaultMaxAge
236
173
  alias_method :default_max_age, :defaultMaxAge
237
174
  alias_method :default_max_age=, :defaultMaxAge=
238
175
 
239
- # The default ACRs (Authentication Context Class References). (String array)
240
176
  attr_accessor :defaultAcrs
241
177
  alias_method :default_acrs, :defaultAcrs
242
178
  alias_method :default_acrs=, :defaultAcrs=
243
179
 
244
- # The flag showing the client application requires the auth_time claim
245
- # to be in an ID token. (Boolean)
246
180
  attr_accessor :authTimeRequired
247
181
  alias_method :auth_time_required, :authTimeRequired
248
182
  alias_method :auth_time_required=, :authTimeRequired=
249
183
 
250
- # The URL which a third party can use to initiate a login by the client
251
- # application. (URI)
252
184
  attr_accessor :loginUri
253
185
  alias_method :login_uri, :loginUri
254
186
  alias_method :login_uri=, :loginUri=
255
187
 
256
- # An array of URLs each of which points to a request object.
257
- # (URI array)
258
188
  attr_accessor :requestUris
259
189
  alias_method :request_uris, :requestUris
260
190
  alias_method :request_uris=, :requestUris=
261
191
 
262
- # The description about the client application. At most 200 letters in unicode.
263
- # (String)
264
192
  attr_accessor :description
265
193
 
266
- # Descriptions about the client application with language tags. (TaggedValue array)
267
194
  attr_accessor :descriptions
268
195
 
269
- # The timestamp at which the client was created. (Integer)
270
196
  attr_accessor :createdAt
271
197
  alias_method :created_at, :createdAt
272
198
  alias_method :created_at=, :createdAt=
273
199
 
274
- # The timestamp at which the client was modified. (Integer)
275
200
  attr_accessor :modifiedAt
276
201
  alias_method :modified_at, :modifiedAt
277
202
  alias_method :modified_at=, :modifiedAt=
278
203
 
279
- # The flag that indicates whether the client uses TLS client certificate bound access tokens
204
+ attr_accessor :extension
205
+
206
+ attr_accessor :tlsClientAuthSubjectDn
207
+ alias_method :tls_client_auth_subject_dn, :tlsClientAuthSubjectDn
208
+ alias_method :tls_client_auth_subject_dn=, :tlsClientAuthSubjectDn=
209
+
210
+ attr_accessor :tlsClientAuthSanDns
211
+ alias_method :tls_client_auth_san_dns, :tlsClientAuthSanDns
212
+ alias_method :tls_client_auth_san_dns=, :tlsClientAuthSanDns=
213
+
214
+ attr_accessor :tlsClientAuthSanUri
215
+ alias_method :tls_client_auth_san_uri, :tlsClientAuthSanUri
216
+ alias_method :tls_client_auth_san_uri=, :tlsClientAuthSanUri=
217
+
218
+ attr_accessor :tlsClientAuthSanIp
219
+ alias_method :tls_client_auth_san_ip, :tlsClientAuthSanIp
220
+ alias_method :tls_client_auth_san_ip=, :tlsClientAuthSanIp=
221
+
222
+ attr_accessor :tlsClientAuthSanEmail
223
+ alias_method :tls_client_auth_san_email, :tlsClientAuthSanEmail
224
+ alias_method :tls_client_auth_san_email=, :tlsClientAuthSanEmail=
225
+
280
226
  attr_accessor :tlsClientCertificateBoundAccessTokens
281
227
  alias_method :tls_client_certificate_bound_access_tokens, :tlsClientCertificateBoundAccessTokens
282
228
  alias_method :tls_client_certificate_bound_access_tokens=, :tlsClientCertificateBoundAccessTokens=
283
229
 
284
- # The key ID of a JWK containing a self-signed certificate of this client.
285
230
  attr_accessor :selfSignedCertificateKeyId
286
231
  alias_method :self_signed_certificate_key_id, :selfSignedCertificateKeyId
287
232
  alias_method :self_signed_certificate_key_id=, :selfSignedCertificateKeyId=
288
233
 
289
- # The special information that extends the client. (ClientExtension)
290
- attr_accessor :extension
234
+ attr_accessor :softwareId
235
+ alias_method :software_id, :softwareId
236
+ alias_method :software_id=, :softwareId=
237
+
238
+ attr_accessor :softwareVersion
239
+ alias_method :software_version, :softwareVersion
240
+ alias_method :software_version=, :softwareVersion=
291
241
 
292
- # The JWS +alg+ algorithm for signing authorization responses.
293
242
  attr_accessor :authorizationSignAlg
294
243
  alias_method :authorization_sign_alg, :authorizationSignAlg
295
244
  alias_method :authorization_sign_alg=, :authorizationSignAlg=
296
245
 
297
- # The JWE +alg+ algorithm for encrypting authorization responses.
298
246
  attr_accessor :authorizationEncryptionAlg
299
247
  alias_method :authorization_encryption_alg, :authorizationEncryptionAlg
300
248
  alias_method :authorization_encryption_alg=, :authorizationEncryptionAlg=
301
249
 
302
- # The JWE +enc+ algorithm for encrypting authorization responses.
303
250
  attr_accessor :authorizationEncryptionEnc
304
251
  alias_method :authorization_encryption_enc, :authorizationEncryptionEnc
305
252
  alias_method :authorization_encryption_enc=, :authorizationEncryptionEnc=
306
253
 
307
- # The backchannel token delivery mode. (String)
308
254
  attr_accessor :bcDeliveryMode
309
255
  alias_method :bc_delivery_mode, :bcDeliveryMode
310
256
  alias_method :bc_delivery_mode=, :bcDeliveryMode=
311
257
 
312
- # The URI of backchannel client notification endpoint. (String)
313
258
  attr_accessor :bcNotificationEndpoint
314
259
  alias_method :bc_notification_endpoint, :bcNotificationEndpoint
315
260
  alias_method :bc_notification_endpoint=, :bcNotificationEndpoint=
316
261
 
317
- # The signature algorithm of the request to the backchannel authentication
318
- # endpoint. (String)
319
262
  attr_accessor :bcRequestSignAlg
320
263
  alias_method :bc_request_sign_alg, :bcRequestSignAlg
321
264
  alias_method :bc_request_sign_alg=, :bcRequestSignAlg=
322
265
 
323
- # The flag which indicates whether a user code is required when this
324
- # client makes a backchannel authentication request. (Boolean)
325
266
  attr_accessor :bcUserCodeRequired
326
267
  alias_method :bc_user_code_required, :bcUserCodeRequired
327
268
  alias_method :bc_user_code_required=, :bcUserCodeRequired=
328
269
 
329
- # The flag which indicates whether this client was registered dynamically
330
- # or (if false) through the regular static method. (Boolean)
331
270
  attr_accessor :dynamicallyRegistered
332
271
  alias_method :dynamically_registered, :dynamicallyRegistered
333
272
  alias_method :dynamically_registered=, :dynamicallyRegistered=
334
273
 
335
- # The string representation of the expected email address subject
336
- # alternative name of the certificate this client will use in mutual
337
- # TLS authentication. (String)
338
- attr_accessor :tlsClientAuthSanEmail
339
- alias_method :tls_client_auth_san_email, :tlsClientAuthSanEmail
340
- alias_method :tls_client_auth_san_email=, :tlsClientAuthSanEmail=
341
-
342
- # The string representation of the expected IP address subject alternative
343
- # name of the certificate this client will use in mutual TLS authentication.
344
- # (String)
345
- attr_accessor :tlsClientAuthSanIp
346
- alias_method :tls_client_auth_san_ip, :tlsClientAuthSanIp
347
- alias_method :tls_client_auth_san_ip=, :tlsClientAuthSanIp=
348
-
349
- # The string representation of the expected URI subject alternative
350
- # name of the certificate this client will use in mutual TLS authentication.
351
- # (String)
352
- attr_accessor :tlsClientAuthSanUri
353
- alias_method :tls_client_auth_san_uri, :tlsClientAuthSanUri
354
- alias_method :tls_client_auth_san_uri=, :tlsClientAuthSanUri=
355
-
356
- # The string representation of the expected DNS subject alternative
357
- # name of the certificate this client will use in mutual TLS authentication.
358
- # (String)
359
- attr_accessor :tlsClientAuthSanDns
360
- alias_method :tls_client_auth_san_dns, :tlsClientAuthSanDns
361
- alias_method :tls_client_auth_san_dns=, :tlsClientAuthSanDns=
362
-
363
- # Sector identifier URI. (String)
364
- attr_accessor :sectorIdentifierUri
365
- alias_method :sector_identifier_uri, :sectorIdentifierUri
366
- alias_method :sector_identifier_uri=, :sectorIdentifierUri=
274
+ attr_accessor :registrationAccessTokenHash
275
+ alias_method :registration_access_token_hash, :registrationAccessTokenHash
276
+ alias_method :registration_access_token_hash=, :registrationAccessTokenHash=
367
277
 
368
- # The data types that this client may use as values of the +type+ field
369
- # in +authorization_details+. (String array)
370
278
  attr_accessor :authorizationDataTypes
371
279
  alias_method :authorization_data_types, :authorizationDataTypes
372
280
  alias_method :authorization_data_types=, :authorizationDataTypes=
373
281
 
374
- # Flag of whether this client is required to use the pushed authorization
375
- # request endpoint. (Boolean)
376
282
  attr_accessor :parRequired
377
283
  alias_method :par_required, :parRequired
378
284
  alias_method :par_required=, :parRequired=
379
285
 
380
- # Flag of whether authorization requests from this client must always
381
- # contain a request object. (Boolean)
382
286
  attr_accessor :requestObjectRequired
383
287
  alias_method :request_object_required, :requestObjectRequired
384
288
  alias_method :request_object_required=, :requestObjectRequired=
385
289
 
386
290
  private
387
291
 
388
- # Integer attributes.
389
- INTEGER_ATTRIBUTES = ::Set.new([
390
- :number, :serviceNumber, :clientId, :defaultMaxAge, :createdAt, :modifiedAt
391
- ])
392
-
393
- # Boolean attributes.
394
- BOOLEAN_ATTRIBUTES = ::Set.new([
395
- :authTimeRequired, :clientIdAliasEnabled, :tlsClientCertificateBoundAccessTokens,
396
- :bcUserCodeRequired, :dynamicallyRegistered, :parRequired, :requestObjectRequired
397
- ])
398
-
399
- # String attributes.
400
- STRING_ATTRIBUTES = ::Set.new([
401
- :developer, :clientSecret, :clientType, :responseTypes, :applicationType,
402
- :clientIdAlias, :clientName, :logoUri, :clientUri, :policyUri, :tosUri,
403
- :jwksUri, :jwks, :sectorIdentifier, :subjectType, :idTokenSignAlg,
404
- :idTokenEncryptionAlg, :idTokenEncryptionEnc, :userInfoSignAlg, :userInfoEncryptionAlg,
405
- :userInfoEncryptionEnc, :requestSignAlg, :requestEncryptionAlg, :requestEncryptionEnc,
406
- :tokenAuthMethod, :tokenAuthSignAlg, :loginUri, :description, :tlsClientAuthSubjectDn,
407
- :selfSignedCertificateKeyId, :authorizationSignAlg, :authorizationEncryptionAlg,
408
- :authorizationEncryptionEnc, :bcDeliveryMode, :bcNotificationEndpoint,
409
- :bcRequestSignAlg, :tlsClientAuthSanEmail, :tlsClientAuthSanIp, :tlsClientAuthSanUri,
410
- :tlsClientAuthSanDns, :sectorIdentifierUri
411
- ])
412
-
413
- # String array attributes.
414
- STRING_ARRAY_ATTRIBUTES = ::Set.new([
415
- :redirectUris, :responseTypes, :grantTypes, :contacts, :defaultAcrs,
416
- :requestUris, :authorizationDataTypes
417
- ])
418
-
419
- # Tagged value array atributes.
420
- TAGGED_VALUE_ARRAY_ATTRIBUTES = ::Set.new([
421
- :clientNames, :logoUris, :clientUris, :policyUris, :tosUris, :descriptions
422
- ])
423
-
424
- # Mapping from snake cases to camel cases.
425
- SNAKE_TO_CAMEL = {
426
- :service_number => :serviceNumber,
427
- :client_id => :clientId,
428
- :client_id_alias => :clientIdAlias,
429
- :client_id_alias_enabled => :clientIdAliasEnabled,
430
- :client_secret => :clientSecret,
431
- :client_type => :clientType,
432
- :redirect_uris => :redirectUris,
433
- :response_types => :responseTypes,
434
- :grant_types => :grantTypes,
435
- :application_type => :applicationType,
436
- :client_name => :clientName,
437
- :client_names => :clientNames,
438
- :logo_uri => :logoUri,
439
- :logo_uris => :logoUris,
440
- :client_uri => :clientUri,
441
- :client_uris => :clientUris,
442
- :policy_uri => :policyUri,
443
- :policy_uris => :policyUris,
444
- :tos_uri => :tosUri,
445
- :tos_uris => :tosUris,
446
- :jwks_uri => :jwksUri,
447
- :sector_identifier => :sectorIdentifier,
448
- :subject_type => :subjectType,
449
- :id_token_sign_alg => :idTokenSignAlg,
450
- :id_token_encryption_alg => :idTokenEncryptionAlg,
451
- :id_token_encryption_enc => :idTokenEncryptionEnc,
452
- :user_info_sign_alg => :userInfoSignAlg,
453
- :user_info_encryption_alg => :userInfoEncryptionAlg,
454
- :user_info_encryption_enc => :userInfoEncryptionEnc,
455
- :request_sign_alg => :requestSignAlg,
456
- :request_encryption_alg => :requestEncryptionAlg,
457
- :request_encryption_enc => :requestEncryptionEnc,
458
- :token_auth_method => :tokenAuthMethod,
459
- :token_auth_sign_alg => :tokenAuthSignAlg,
460
- :default_max_age => :defaultMaxAge,
461
- :default_acrs => :defaultAcrs,
462
- :auth_time_required => :authTimeRequired,
463
- :login_uri => :loginUri,
464
- :request_uris => :requestUris,
465
- :created_at => :createdAt,
466
- :modified_at => :modifiedAt,
467
- :tls_client_auth_subject_dn => :tlsClientAuthSubjectDn,
468
- :tls_client_certificate_bound_access_tokens => :tlsClientCertificateBoundAccessTokens,
469
- :self_signed_certificate_key_id => :selfSignedCertificateKeyId,
470
- :authorization_sign_alg => :authorizationSignAlg,
471
- :authorization_encryption_alg => :authorizationEncryptionAlg,
472
- :authorization_encryption_enc => :authorizationEncryptionEnc,
473
- :bc_delivery_mode => :bcDeliveryMode,
474
- :bc_notification_endpoint => :bcNotificationEndpoint,
475
- :bc_request_sign_alg => :bcRequestSignAlg,
476
- :bc_user_code_required => :bcUserCodeRequired,
477
- :dynamically_registered => :dynamicallyRegistered,
478
- :tls_client_auth_san_email => :tlsClientAuthSanEmail,
479
- :tls_client_auth_san_ip => :tlsClientAuthSanIp,
480
- :tls_client_auth_san_uri => :tlsClientAuthSanUri,
481
- :tls_client_auth_san_dns => :tlsClientAuthSanDns,
482
- :sector_identifier_uri => :sectorIdentifierUri,
483
- :authorization_data_types => :authorizationDataTypes,
484
- :par_required => :parRequired,
485
- :request_object_required => :requestObjectRequired
486
- }
487
-
488
- # The constructor
489
- def initialize(hash = nil)
490
- # Set default values to integer attributes.
491
- INTEGER_ATTRIBUTES.each do |attr|
492
- send("#{attr}=", 0)
493
- end
494
-
495
- # Set default values to boolean attributes.
496
- BOOLEAN_ATTRIBUTES.each do |attr|
497
- send("#{attr}=", false)
498
- end
499
-
500
- # Set default values to string attributes.
501
- STRING_ATTRIBUTES.each do |attr|
502
- send("#{attr}=", nil)
503
- end
504
-
505
- # Set default values to string array attributes.
506
- STRING_ARRAY_ATTRIBUTES.each do |attr|
507
- send("#{attr}=", nil)
508
- end
509
-
510
- # Set default values to tagged value array attributes.
511
- TAGGED_VALUE_ARRAY_ATTRIBUTES.each do |attr|
512
- send("#{attr}=", nil)
513
- end
514
-
515
- @extension = nil
516
-
517
- # Set attribute values using the given hash.
518
- authlete_model_update(hash)
519
- end
520
-
521
- def authlete_model_convert_key(key)
522
- key = key.to_sym
523
-
524
- # Convert snakecase to camelcase, if necessary.
525
- if SNAKE_TO_CAMEL.has_key?(key)
526
- key = SNAKE_TO_CAMEL[key]
527
- end
528
-
529
- key
530
- end
531
-
532
- def authlete_model_simple_attribute?(key)
533
- INTEGER_ATTRIBUTES.include?(key) or
534
- BOOLEAN_ATTRIBUTES.include?(key) or
535
- STRING_ATTRIBUTES.include?(key) or
536
- STRING_ARRAY_ATTRIBUTES.include?(key)
537
- end
538
-
539
- def authlete_model_update(hash)
540
- return if hash.nil?
541
-
542
- hash.each do |key, value|
543
- key = authlete_model_convert_key(key)
544
-
545
- if authlete_model_simple_attribute?(key)
546
- send("#{key}=", value)
547
- elsif TAGGED_VALUE_ARRAY_ATTRIBUTES.include?(key)
548
- # Get an array consisting of "TaggedValue" objects.
549
- parsed = get_parsed_array(value) do |element|
550
- Authlete::Model::TaggedValue.parse(element)
551
- end
552
-
553
- send("#{key}=", parsed)
554
- elsif key == :extension
555
- @extension = Authlete::Model::ClientExtension.new(value)
556
- end
557
- end
558
-
559
- self
292
+ def defaults
293
+ {
294
+ number: 0,
295
+ serviceNumber: 0,
296
+ developer: nil,
297
+ clientId: 0,
298
+ clientIdAlias: nil,
299
+ clientIdAliasEnabled: false,
300
+ clientSecret: nil,
301
+ clientType: nil,
302
+ redirectUris: nil,
303
+ responseTypes: nil,
304
+ grantTypes: nil,
305
+ applicationType: nil,
306
+ contacts: nil,
307
+ clientName: nil,
308
+ clientNames: nil,
309
+ logoUri: nil,
310
+ logoUris: nil,
311
+ clientUri: nil,
312
+ clientUris: nil,
313
+ policyUri: nil,
314
+ policyUris: nil,
315
+ tosUri: nil,
316
+ tosUris: nil,
317
+ jwksUri: nil,
318
+ jwks: nil,
319
+ derivedSectorIdentifier: nil,
320
+ sectorIdentifierUri: nil,
321
+ subjectType: nil,
322
+ idTokenSignAlg: nil,
323
+ idTokenEncryptionAlg: nil,
324
+ idTokenEncryptionEnc: nil,
325
+ userInfoSignAlg: nil,
326
+ userInfoEncryptionAlg: nil,
327
+ userInfoEncryptionEnc: nil,
328
+ requestSignAlg: nil,
329
+ requestEncryptionAlg: nil,
330
+ requestEncryptionEnc: nil,
331
+ tokenAuthMethod: nil,
332
+ tokenAuthSignAlg: nil,
333
+ defaultMaxAge: 0,
334
+ defaultAcrs: nil,
335
+ authTimeRequired: false,
336
+ loginUri: nil,
337
+ requestUris: nil,
338
+ description: nil,
339
+ descriptions: nil,
340
+ createdAt: 0,
341
+ modifiedAt: 0,
342
+ extension: nil,
343
+ tlsClientAuthSubjectDn: nil,
344
+ tlsClientAuthSanDns: nil,
345
+ tlsClientAuthSanUri: nil,
346
+ tlsClientAuthSanIp: nil,
347
+ tlsClientAuthSanEmail: nil,
348
+ tlsClientCertificateBoundAccessTokens: false,
349
+ selfSignedCertificateKeyId: nil,
350
+ softwareId: nil,
351
+ softwareVersion: nil,
352
+ authorizationSignAlg: nil,
353
+ authorizationEncryptionAlg: nil,
354
+ authorizationEncryptionEnc: nil,
355
+ bcDeliveryMode: nil,
356
+ bcNotificationEndpoint: nil,
357
+ bcRequestSignAlg: nil,
358
+ bcUserCodeRequired: false,
359
+ dynamicallyRegistered: false,
360
+ registrationAccessTokenHash: nil,
361
+ authorizationDataTypes: nil,
362
+ parRequired: false,
363
+ requestObjectRequired: false
364
+ }
560
365
  end
561
366
 
562
- public
563
-
564
- # Construct an instance from the given hash.
565
- #
566
- # If the given argument is nil or is not a Hash, nil is returned.
567
- # Otherwise, Service.new(hash) is returned.
568
- def self.parse(hash)
569
- if hash.nil? or (hash.kind_of?(Hash) == false)
570
- return nil
571
- end
572
-
573
- Client.new(hash)
367
+ def set_params(hash)
368
+ @number = hash[:number]
369
+ @serviceNumber = hash[:serviceNumber]
370
+ @developer = hash[:developer]
371
+ @clientId = hash[:clientId]
372
+ @clientIdAlias = hash[:clientIdAlias]
373
+ @clientIdAliasEnabled = hash[:clientIdAliasEnabled]
374
+ @clientSecret = hash[:clientSecret]
375
+ @clientType = hash[:clientType]
376
+ @redirectUris = hash[:redirectUris]
377
+ @responseTypes = hash[:responseTypes]
378
+ @grantTypes = hash[:grantTypes]
379
+ @applicationType = hash[:applicationType]
380
+ @contacts = hash[:contacts]
381
+ @clientName = hash[:clientName]
382
+ @clientNames = get_parsed_array(hash[:clientNames]) { |e| Authlete::Model::TaggedValue.parse(e) }
383
+ @logoUri = hash[:logoUri]
384
+ @logoUris = get_parsed_array(hash[:logoUris]) { |e| Authlete::Model::TaggedValue.parse(e) }
385
+ @clientUri = hash[:clientUri]
386
+ @clientUris = get_parsed_array(hash[:clientUris]) { |e| Authlete::Model::TaggedValue.parse(e) }
387
+ @policyUri = hash[:policyUri]
388
+ @policyUris = get_parsed_array(hash[:policyUris]) { |e| Authlete::Model::TaggedValue.parse(e) }
389
+ @tosUri = hash[:tosUri]
390
+ @tosUris = get_parsed_array(hash[:tosUris]) { |e| Authlete::Model::TaggedValue.parse(e) }
391
+ @jwksUri = hash[:jwksUri]
392
+ @jwks = hash[:jwks]
393
+ @derivedSectorIdentifier = hash[:derivedSectorIdentifier]
394
+ @sectorIdentifierUri = hash[:sectorIdentifierUri]
395
+ @subjectType = hash[:subjectType]
396
+ @idTokenSignAlg = hash[:idTokenSignAlg]
397
+ @idTokenEncryptionAlg = hash[:idTokenEncryptionAlg]
398
+ @idTokenEncryptionEnc = hash[:idTokenEncryptionEnc]
399
+ @userInfoSignAlg = hash[:userInfoSignAlg]
400
+ @userInfoEncryptionAlg = hash[:userInfoEncryptionAlg]
401
+ @userInfoEncryptionEnc = hash[:userInfoEncryptionEnc]
402
+ @requestSignAlg = hash[:requestSignAlg]
403
+ @requestEncryptionAlg = hash[:requestEncryptionAlg]
404
+ @requestEncryptionEnc = hash[:requestEncryptionEnc]
405
+ @tokenAuthMethod = hash[:tokenAuthMethod]
406
+ @tokenAuthSignAlg = hash[:tokenAuthSignAlg]
407
+ @defaultMaxAge = hash[:defaultMaxAge]
408
+ @defaultAcrs = hash[:defaultAcrs]
409
+ @authTimeRequired = hash[:authTimeRequired]
410
+ @loginUri = hash[:loginUri]
411
+ @requestUris = hash[:requestUris]
412
+ @description = hash[:description]
413
+ @descriptions = get_parsed_array(hash[:descriptions]) { |e| Authlete::Model::TaggedValue.parse(e) }
414
+ @createdAt = hash[:createdAt]
415
+ @modifiedAt = hash[:modifiedAt]
416
+ @extension = Authlete::Model::ClientExtension.parse(hash[:extension])
417
+ @tlsClientAuthSubjectDn = hash[:tlsClientAuthSubjectDn]
418
+ @tlsClientAuthSanDns = hash[:tlsClientAuthSanDns]
419
+ @tlsClientAuthSanUri = hash[:tlsClientAuthSanUri]
420
+ @tlsClientAuthSanIp = hash[:tlsClientAuthSanIp]
421
+ @tlsClientAuthSanEmail = hash[:tlsClientAuthSanEmail]
422
+ @tlsClientCertificateBoundAccessTokens = hash[:tlsClientCertificateBoundAccessTokens]
423
+ @selfSignedCertificateKeyId = hash[:selfSignedCertificateKeyId]
424
+ @softwareId = hash[:softwareId]
425
+ @softwareVersion = hash[:softwareVersion]
426
+ @authorizationSignAlg = hash[:authorizationSignAlg]
427
+ @authorizationEncryptionAlg = hash[:authorizationEncryptionAlg]
428
+ @authorizationEncryptionEnc = hash[:authorizationEncryptionEnc]
429
+ @bcDeliveryMode = hash[:bcDeliveryMode]
430
+ @bcNotificationEndpoint = hash[:bcNotificationEndpoint]
431
+ @bcRequestSignAlg = hash[:bcRequestSignAlg]
432
+ @bcUserCodeRequired = hash[:bcUserCodeRequired]
433
+ @dynamicallyRegistered = hash[:dynamicallyRegistered]
434
+ @registrationAccessTokenHash = hash[:registrationAccessTokenHash]
435
+ @authorizationDataTypes = hash[:authorizationDataTypes]
436
+ @parRequired = hash[:parRequired]
437
+ @requestObjectRequired = hash[:requestObjectRequired]
574
438
  end
575
439
 
576
- # Set attribute values using the given hash.
577
- def update(hash)
578
- authlete_model_update?(hash)
579
- end
440
+ def to_hash_value(key, var)
441
+ raw_val = instance_variable_get(var)
580
442
 
581
- # Convert this object into a hash.
582
- def to_hash
583
- hash = {}
584
-
585
- instance_variables.each do |var|
586
- key = var.to_s.delete("@").to_sym
587
- val = instance_variable_get(var)
588
-
589
- if authlete_model_simple_attribute?(key) or val.nil?
590
- hash[key] = val
591
- elsif TAGGED_VALUE_ARRAY_ATTRIBUTES.include?(key)
592
- hash[key] = val.map { |element| element.to_hash }
593
- elsif key == :extension
594
- # For attributes such as :extension
595
- hash[key] = val.to_hash
596
- end
443
+ case key
444
+ when :clientNames, :logoUris, :clientUris, :policyUris, :tosUris, :descriptions
445
+ raw_val&.map { |e| e.to_hash }
446
+ when :extension
447
+ raw_val&.to_hash
448
+ else
449
+ raw_val
597
450
  end
598
-
599
- hash
600
451
  end
601
452
  end
602
453
  end
603
- end
454
+ end