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
@@ -0,0 +1,63 @@
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
+ module Request
21
+ class DeviceAuthorizationRequest < Authlete::Model::Request::Base
22
+
23
+ attr_accessor :parameters
24
+
25
+ attr_accessor :clientId
26
+ alias_method :client_id, :clientId
27
+ alias_method :client_id=, :clientId=
28
+
29
+ attr_accessor :clientSecret
30
+ alias_method :client_secret, :clientSecret
31
+ alias_method :client_secret=, :clientSecret=
32
+
33
+ attr_accessor :clientCertificate
34
+ alias_method :client_certificate, :clientCertificate
35
+ alias_method :client_certificate=, :clientCertificate=
36
+
37
+ attr_accessor :clientCertificatePath
38
+ alias_method :client_certificate_path, :clientCertificatePath
39
+ alias_method :client_certificate_path=, :clientCertificatePath=
40
+
41
+ private
42
+
43
+ def defaults
44
+ {
45
+ parameters: nil,
46
+ clientId: nil,
47
+ clientSecret: nil,
48
+ clientCertificate: nil,
49
+ clientCertificatePath: nil
50
+ }
51
+ end
52
+
53
+ def set_params(hash)
54
+ @parameters = hash[:parameters]
55
+ @clientId = hash[:clientId]
56
+ @clientSecret = hash[:clientSecret]
57
+ @clientCertificate = hash[:clientCertificate]
58
+ @clientCertificatePath = hash[:clientCertificatePath]
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,99 @@
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
+ module Request
21
+ class DeviceCompleteRequest < Authlete::Model::Request::Base
22
+ include Authlete::Utility
23
+
24
+ attr_accessor :userCode
25
+ alias_method :user_code, :userCode
26
+ alias_method :user_code=, :userCode=
27
+
28
+ attr_accessor :result
29
+
30
+ attr_accessor :subject
31
+
32
+ attr_accessor :sub
33
+
34
+ attr_accessor :authTime
35
+ alias_method :auth_time, :authTime
36
+ alias_method :auth_time=, :authTime=
37
+
38
+ attr_accessor :acr
39
+
40
+ attr_accessor :claims
41
+
42
+ attr_accessor :properties
43
+
44
+ attr_accessor :scopes
45
+
46
+ attr_accessor :errorDescription
47
+ alias_method :error_description, :errorDescription
48
+ alias_method :error_description=, :errorDescription=
49
+
50
+ attr_accessor :errorUri
51
+ alias_method :error_uri, :errorUri
52
+ alias_method :error_uri=, :errorUri=
53
+
54
+ private
55
+
56
+ def defaults
57
+ {
58
+ userCode: nil,
59
+ result: nil,
60
+ subject: nil,
61
+ sub: nil,
62
+ authTime: 0,
63
+ acr: nil,
64
+ claims: nil,
65
+ properties: nil,
66
+ scopes: nil,
67
+ errorDescription: nil,
68
+ errorUri: nil
69
+ }
70
+ end
71
+
72
+ def set_params(hash)
73
+ @userCode = hash[:userCode]
74
+ @result = hash[:result]
75
+ @subject = hash[:subject]
76
+ @sub = hash[:sub]
77
+ @authTime = hash[:authTime]
78
+ @acr = hash[:acr]
79
+ @claims = hash[:claims]
80
+ @properties = get_parsed_array(hash[:properties]) { |e| Authlete::Model::Property.parse(e) }
81
+ @scopes = hash[:scopes]
82
+ @errorDescription = hash[:errorDescription]
83
+ @errorUri = hash[:errorUri]
84
+ end
85
+
86
+ def to_hash_value(key, var)
87
+ raw_val = instance_variable_get(var)
88
+
89
+ case key
90
+ when :properties
91
+ raw_val&.map { |e| e.to_hash }
92
+ else
93
+ raw_val
94
+ end
95
+ end
96
+ end
97
+ end
98
+ end
99
+ end
@@ -0,0 +1,40 @@
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
+ module Request
21
+ class DeviceVerificationRequest < Authlete::Model::Request::Base
22
+ include Authlete::Utility
23
+
24
+ attr_accessor :userCode
25
+ alias_method :user_code, :userCode
26
+ alias_method :user_code=, :userCode=
27
+
28
+ private
29
+
30
+ def defaults
31
+ { userCode: nil }
32
+ end
33
+
34
+ def set_params(hash)
35
+ @userCode = hash[:userCode]
36
+ end
37
+ end
38
+ end
39
+ end
40
+ 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,89 +15,23 @@
15
15
  # limitations under the License.
16
16
 
17
17
 
18
- require 'set'
19
-
20
-
21
18
  module Authlete
22
19
  module Model
23
20
  module Request
24
- # == Authlete::Model::Request::GrantedScopesRequest class
25
- #
26
- # This class represents a request to Authlete's /api/client/granted_scopes/get/{clientId} API
27
- # and api/client/granted_scopes/delete/{clientId} API.
28
- class GrantedScopesRequest < Authlete::Model::Hashable
29
- # Unique user ID. (String)
21
+ class GrantedScopesRequest < Authlete::Model::Request::Base
22
+
30
23
  attr_accessor :subject
31
24
 
32
25
  private
33
26
 
34
- # String attributes.
35
- STRING_ATTRIBUTES = ::Set.new([ :subject ])
36
-
37
- # The constructor which takes a hash that represents a JSON request to
38
- # Authlete's /api/auth/token/create API.
39
- def initialize(hash = nil)
40
- # Set default values to string attributes.
41
- STRING_ATTRIBUTES.each do |attr|
42
- send("#{attr}=", nil)
43
- end
44
-
45
- # Set attribute values using the given hash.
46
- authlete_model_update(hash)
27
+ def defaults
28
+ { subject: nil }
47
29
  end
48
30
 
49
- def authlete_model_convert_key(key)
50
- key.to_sym
51
- end
52
-
53
- def authlete_model_simple_attribute?(key)
54
- STRING_ATTRIBUTES.include?(key)
55
- end
56
-
57
- def authlete_model_update(hash)
58
- return if hash.nil?
59
-
60
- hash.each do |key, value|
61
- key = authlete_model_convert_key(key)
62
-
63
- if authlete_model_simple_attribute?(key)
64
- send("#{key}=", value)
65
- end
66
- end
67
-
68
- self
69
- end
70
-
71
- public
72
-
73
- # Construct an instance from the given hash.
74
- #
75
- # If the given argument is nil or is not a Hash, nil is returned.
76
- # Otherwise, GrantedScopesRequest.new(hash) is returned.
77
- def self.parse(hash)
78
- if hash.nil? or (hash.kind_of?(Hash) == false)
79
- return nil
80
- end
81
-
82
- return GrantedScopesRequest.new(hash)
83
- end
84
-
85
- # Convert this object into a hash.
86
- def to_hash
87
- hash = {}
88
-
89
- instance_variables.each do |var|
90
- key = var.to_s.delete("@").to_sym
91
- val = instance_variable_get(var)
92
-
93
- if authlete_model_simple_attribute?(key) or val.nil?
94
- hash[key] = val
95
- end
96
- end
97
-
98
- hash
31
+ def set_params(hash)
32
+ @subject = hash[:subject]
99
33
  end
100
34
  end
101
35
  end
102
36
  end
103
- end
37
+ 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,104 +15,45 @@
15
15
  # limitations under the License.
16
16
 
17
17
 
18
- require 'set'
19
-
20
-
21
18
  module Authlete
22
19
  module Model
23
20
  module Request
24
- # == Authlete::Model::Request::IntrospectionRequest class
25
- #
26
- # This class represents a request to Authlete's /api/auth/introspection API.
27
- class IntrospectionRequest < Authlete::Model::Hashable
28
- # An access token to introspect. (String)
21
+ class IntrospectionRequest < Authlete::Model::Request::Base
22
+
29
23
  attr_accessor :token
30
24
 
31
- # Scopes which are required to access the target protected resource.
32
- # (String array)
33
25
  attr_accessor :scopes
34
26
 
35
- # Unique user ID. (String)
36
27
  attr_accessor :subject
37
28
 
38
- private
39
-
40
- # String attributes.
41
- STRING_ATTRIBUTES = ::Set.new([ :token, :subject ])
42
-
43
- # String array attributes.
44
- STRING_ARRAY_ATTRIBUTES = ::Set.new([ :scopes ])
45
-
46
- # The constructor which takes a hash that represents a JSON request to
47
- # Authlete's /api/auth/introspection API.
48
- def initialize(hash = nil)
49
- # Set default values to string attributes.
50
- STRING_ATTRIBUTES.each do |attr|
51
- send("#{attr}=", nil)
52
- end
53
-
54
- # Set default values to string array attributes.
55
- STRING_ARRAY_ATTRIBUTES.each do |attr|
56
- send("#{attr}=", nil)
57
- end
58
-
59
- # Set attribute values using the given hash.
60
- authlete_model_update(hash)
61
- end
62
-
63
- def authlete_model_convert_key(key)
64
- key.to_sym
65
- end
66
-
67
- def authlete_model_simple_attribute?(key)
68
- STRING_ATTRIBUTES.include?(key) or
69
- STRING_ARRAY_ATTRIBUTES.include?(key)
70
- end
29
+ attr_accessor :dpop
71
30
 
72
- def authlete_model_update(hash)
73
- return if hash.nil?
31
+ attr_accessor :htu
74
32
 
75
- hash.each do |key, value|
76
- key = authlete_model_convert_key(key)
77
-
78
- if authlete_model_simple_attribute?(key)
79
- send("#{key}=", value)
80
- end
81
- end
82
-
83
- self
84
- end
33
+ attr_accessor :htm
85
34
 
86
- public
87
-
88
- # Construct an instance from the given hash.
89
- #
90
- # If the given argument is nil or is not a Hash, nil is returned.
91
- # Otherwise, IntrospectionRequest.new(hash) is returned.
92
- def self.parse(hash)
93
- if hash.nil? or (hash.kind_of?(Hash) == false)
94
- return nil
95
- end
35
+ private
96
36
 
97
- return IntrospectionRequest.new(hash)
37
+ def defaults
38
+ {
39
+ token: nil,
40
+ scopes: nil,
41
+ subject: nil,
42
+ dpop: nil,
43
+ htu: nil,
44
+ htm: nil
45
+ }
98
46
  end
99
47
 
100
- # Convert this object into a hash.
101
- def to_hash
102
- hash = {}
103
-
104
- instance_variables.each do |var|
105
- key = var.to_s.delete("@").to_sym
106
- val = instance_variable_get(var)
107
-
108
- if authlete_model_simple_attribute?(key) or val.nil?
109
- hash[key] = val
110
- end
111
- end
112
-
113
- hash
48
+ def set_params(hash)
49
+ @token = hash[:token]
50
+ @scopes = hash[:scopes]
51
+ @subject = hash[:subject]
52
+ @dpop = hash[:dpop]
53
+ @htu = hash[:htu]
54
+ @htm = hash[:htu]
114
55
  end
115
56
  end
116
57
  end
117
58
  end
118
- end
59
+ end
@@ -0,0 +1,64 @@
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
+ module Request
21
+ class PushedAuthReqRequest < Authlete::Model::Request::Base
22
+ include Authlete::Utility
23
+
24
+ attr_accessor :parameters
25
+
26
+ attr_accessor :clientId
27
+ alias_method :client_id, :clientId
28
+ alias_method :client_id=, :clientId=
29
+
30
+ attr_accessor :clientSecret
31
+ alias_method :client_secret, :clientSecret
32
+ alias_method :client_secret=, :clientSecret=
33
+
34
+ attr_accessor :clientCertificate
35
+ alias_method :client_certificate, :clientCertificate
36
+ alias_method :client_certificate=, :clientCertificate=
37
+
38
+ attr_accessor :clientCertificatePath
39
+ alias_method :client_certificate_path, :clientCertificatePath
40
+ alias_method :client_certificate_path=, :clientCertificatePath=
41
+
42
+ private
43
+
44
+ def defaults
45
+ {
46
+ parameters: nil,
47
+ clientId: nil,
48
+ clientSecret: nil,
49
+ clientCertificate: nil,
50
+ clientCertificatePath: nil
51
+ }
52
+ end
53
+
54
+ def set_params(hash)
55
+ @parameters = hash[:parameters]
56
+ @clientId = hash[:clientId]
57
+ @clientSecret = hash[:clientSecret]
58
+ @clientCertificate = hash[:clientCertificate]
59
+ @clientCertificatePath = hash[:clientCertificatePath]
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end