authlete 1.0.23 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
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 +153 -322
  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 +205 -349
  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 +488 -677
  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 +93 -0
  145. data/test/authlete/model/test_client.rb +469 -0
  146. data/test/authlete/model/test_named-uri.rb +83 -0
  147. data/test/authlete/model/test_pair.rb +83 -0
  148. data/test/authlete/model/test_property.rb +88 -0
  149. data/test/authlete/model/test_result.rb +68 -0
  150. data/test/authlete/model/test_scope.rb +104 -0
  151. data/test/authlete/model/test_service-owner.rb +80 -0
  152. data/test/authlete/model/test_service.rb +630 -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,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 Response
21
+ class TokenListResponse < Authlete::Model::Base
22
+ include Authlete::Utility
23
+
24
+ attr_accessor :start
25
+
26
+ attr_accessor :end
27
+
28
+ attr_accessor :client
29
+
30
+ attr_accessor :subject
31
+
32
+ attr_accessor :totalCount
33
+ alias_method :total_count, :totalCount
34
+ alias_method :total_count=, :totalCount=
35
+
36
+ attr_accessor :accessTokens
37
+ alias_method :access_tokens, :accessTokens
38
+ alias_method :access_tokens=, :accessTokens=
39
+
40
+ private
41
+
42
+ def defaults
43
+ {
44
+ start: nil,
45
+ end: nil,
46
+ client: nil,
47
+ subject: nil,
48
+ totalCount: 0,
49
+ accessTokens: nil
50
+ }
51
+ end
52
+
53
+ def set_params(hash)
54
+ @start = hash[:start]
55
+ @end = hash[:end]
56
+ @client = Authlete::Model::Client.parse(hash[:client])
57
+ @subject = hash[:subject]
58
+ @totalCount = hash[:totalCount]
59
+ @accessTokens = get_parsed_array(hash[:accessTokens]) { |e| Authlete::Model::Response::AccessToken.parse(e) }
60
+ end
61
+ end
62
+ end
63
+ end
64
+ 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.
@@ -18,152 +18,132 @@
18
18
  module Authlete
19
19
  module Model
20
20
  module Response
21
- # == Authlete::Model::Response::TokenResponse class
22
- #
23
- # This class represents a response from Authlete's /api/auth/token API.
24
21
  class TokenResponse < Authlete::Model::Result
25
- include Authlete::Utility
26
- # The next action that the service implementation should take.
27
- # (String)
22
+
28
23
  attr_accessor :action
29
24
 
30
- # The response content which can be used to generate a response
31
- # to the client application. The format of the value varies
32
- # depending on the value of "action". (String)
33
25
  attr_accessor :responseContent
34
26
  alias_method :response_content, :responseContent
35
27
  alias_method :response_content=, :responseContent=
36
28
 
37
- # The value of "username" request parameter.
38
- #
39
- # This value is non-nil only when the value of
40
- # "grant_type" request parameter in the token request is "password".
41
29
  attr_accessor :username
42
30
 
43
- # The value of "password" request parameter.
44
- #
45
- # This value is non-nil only when the value of
46
- # "grant_type" request parameter in the token request is "password".
47
31
  attr_accessor :password
48
32
 
49
- # The ticket issued from Authlete's /api/auth/token endpoint.
50
- # This parameter is to be used as "ticket" request parameter
51
- # for /api/auth/token/issue API or /api/auth/token/fail API.
52
- # This parameter is non-nil only when "action" is "PASSWORD PASSWORD".
53
33
  attr_accessor :ticket
54
34
 
55
- # The newly issued access token. (String)
56
35
  attr_accessor :accessToken
57
36
  alias_method :access_token, :accessToken
58
37
  alias_method :access_token=, :accessToken=
59
38
 
60
- # The datetime at which the newly issued access token will expire.
61
- # The value is represented in milliseconds since the Unix epoch (1970-01-01).
62
- # (Integer)
63
39
  attr_accessor :accessTokenExpiresAt
64
40
  alias_method :access_token_expires_at, :accessTokenExpiresAt
65
41
  alias_method :access_token_expires_at=, :accessTokenExpiresAt=
66
42
 
67
- # The duration of the newly issued access token in seconds. (Integer)
68
43
  attr_accessor :accessTokenDuration
69
44
  alias_method :access_token_duration, :accessTokenDuration
70
45
  alias_method :access_token_duration=, :accessTokenDuration=
71
46
 
72
- # The newly issued refresh token. (String)
73
47
  attr_accessor :refreshToken
74
48
  alias_method :refresh_token, :refreshToken
75
49
  alias_method :refresh_token=, :refreshToken=
76
50
 
77
- # The datetime at which the newly issued refresh token will expire.
78
- # The value is represented in milliseconds since the Unix epoch (1970-01-01).
79
- # (Integer)
80
51
  attr_accessor :refreshTokenExpiresAt
81
52
  alias_method :refresh_token_expires_at, :refreshTokenExpiresAt
82
53
  alias_method :refresh_token_expires_at=, :refreshTokenExpiresAt=
83
54
 
84
- # The duration of the newly issued refresh token in seconds. (Integer)
85
55
  attr_accessor :refreshTokenDuration
86
56
  alias_method :refresh_token_duration, :refreshTokenDuration
87
57
  alias_method :refresh_token_duration=, :refreshTokenDuration=
88
58
 
89
- # The newly issued ID token. Note that an ID token is issued from
90
- # a Token Endpoint only when the "response_type" request parameter
91
- # of the authorization request to an Authorization Endpoint has contained
92
- # "code" and the "scope" request parameter has contained "openid".
93
- # (String)
94
59
  attr_accessor :idToken
95
60
  alias_method :id_token, :idToken
96
61
  alias_method :id_token=, :idToken=
97
62
 
98
- # The grant type of the token request. (String)
99
63
  attr_accessor :grantType
100
64
  alias_method :grant_type, :grantType
101
65
  alias_method :grant_type=, :grantType=
102
66
 
103
- # The client ID. (Integer)
104
67
  attr_accessor :clientId
105
68
  alias_method :client_id, :clientId
106
69
  alias_method :client_id=, :clientId=
107
70
 
108
- # Alias of client ID. (String)
109
71
  attr_accessor :clientIdAlias
110
72
  alias_method :client_id_alias, :clientIdAlias
111
73
  alias_method :client_id_alias=, :clientIdAlias=
112
74
 
113
- # The flag which indicates whether the client ID alias was used when
114
- # the token request was made. "true" if the client ID alias was used
115
- # when the token request was made. (Boolean)
116
75
  attr_accessor :clientIdAliasUsed
117
76
  alias_method :client_id_alias_used, :clientIdAliasUsed
118
77
  alias_method :client_id_alias_used=, :clientIdAliasUsed=
119
78
 
120
- # The subject (= resource owner's ID) of the access token.
121
- # Even if an access token has been issued by the call of /api/auth/token API,
122
- # this parameter is "nil" if the flow of the token request was "Client Credentials Flow"
123
- # (grant_type=client_credentials) because it means the access token
124
- # is not associated with any specific end-user.
125
- # (String)
126
79
  attr_accessor :subject
127
80
 
128
- # The scopes covered by the access token.
129
- # (Scope array)
130
81
  attr_accessor :scopes
131
82
 
132
- # The extra properties associated with the access token.
133
- # This parameter is "nil" when no extra property is associated with
134
- # the issued access token.
135
83
  attr_accessor :properties
136
84
 
85
+ attr_accessor :jwtAccessToken
86
+ alias_method :jwt_access_token, :jwtAccessToken
87
+ alias_method :jwt_access_token=, :jwtAccessToken=
88
+
89
+ attr_accessor :accessTokenResources
90
+ alias_method :access_token_resources, :accessTokenResources
91
+ alias_method :access_token_resources=, :accessTokenResources=
92
+
137
93
  private
138
94
 
139
- # The constructor which takes a hash that represents a JSON response
140
- # from Authlete's /api/auth/token API.
141
- def initialize(hash = {})
95
+ def defaults
96
+ super.merge(
97
+ action: nil,
98
+ responseContent: nil,
99
+ username: nil,
100
+ password: nil,
101
+ ticket: nil,
102
+ accessToken: nil,
103
+ accessTokenExpiresAt: 0,
104
+ accessTokenDuration: 0,
105
+ refreshToken: nil,
106
+ refreshTokenExpiresAt: 0,
107
+ refreshTokenDuration: 0,
108
+ idToken: nil,
109
+ grantType: nil,
110
+ clientId: 0,
111
+ clientIdAlias: nil,
112
+ clientIdAliasUsed: false,
113
+ subject: nil,
114
+ scopes: nil,
115
+ properties: nil,
116
+ jwtAccessToken: nil,
117
+ accessTokenResources: nil
118
+ )
119
+ end
120
+
121
+ def set_params(hash)
142
122
  super(hash)
143
123
 
144
- @action = extract_value(hash, :action)
145
- @responseContent = extract_value(hash, :responseContent)
146
- @username = extract_value(hash, :username)
147
- @password = extract_value(hash, :password)
148
- @ticket = extract_value(hash, :ticket)
149
- @accessToken = extract_value(hash, :accessToken)
150
- @accessTokenExpiresAt = extract_integer_value(hash, :accessTokenExpiresAt)
151
- @accessTokenDuration = extract_integer_value(hash, :accessTokenDuration)
152
- @refreshToken = extract_value(hash, :refreshToken)
153
- @refreshTokenExpiresAt = extract_integer_value(hash, :refreshTokenExpiresAt)
154
- @refreshTokenDuration = extract_integer_value(hash, :refreshTokenDuration)
155
- @idToken = extract_value(hash, :idToken)
156
- @grantType = extract_value(hash, :grantType)
157
- @clientId = extract_integer_value(hash, :clientId)
158
- @clientIdAlias = extract_value(hash, :clientIdAlias)
159
- @clientIdAliasUsed = extract_boolean_value(hash, :clientIdAliasUsed)
160
- @subject = extract_value(hash, :subject)
161
- @scopes = extract_value(hash, :scopes)
162
- @properties = extract_array_value(hash, :scopes) do |element|
163
- Authlete::Model::Property.parse(element)
164
- end
124
+ @action = hash[:action]
125
+ @responseContent = hash[:responseContent]
126
+ @username = hash[:username]
127
+ @password = hash[:password]
128
+ @ticket = hash[:ticket]
129
+ @accessToken = hash[:accessToken]
130
+ @accessTokenExpiresAt = hash[:accessTokenExpiresAt]
131
+ @accessTokenDuration = hash[:accessTokenDuration]
132
+ @refreshToken = hash[:refreshToken]
133
+ @refreshTokenExpiresAt = hash[:refreshTokenExpiresAt]
134
+ @refreshTokenDuration = hash[:refreshTokenDuration]
135
+ @idToken = hash[:idToken]
136
+ @grantType = hash[:grantType]
137
+ @clientId = hash[:clientId]
138
+ @clientIdAlias = hash[:clientIdAlias]
139
+ @clientIdAliasUsed = hash[:clientIdAliasUsed]
140
+ @subject = hash[:subject]
141
+ @scopes = hash[:scopes]
142
+ @properties = get_parsed_array(hash[:properties]) { |e| Authlete::Model::Property.parse(e) }
143
+ @jwtAccessToken = hash[:jwtAccessToken]
144
+ @accessTokenResources = hash[:accessTokenResources]
165
145
  end
166
146
  end
167
147
  end
168
148
  end
169
- end
149
+ 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.
@@ -18,45 +18,50 @@
18
18
  module Authlete
19
19
  module Model
20
20
  module Response
21
- # == Authlete::Model::Response::TokenUpdateResponse class
22
- #
23
- # A class that represents a response from Authlete's
24
- # /api/auth/token/update API.
25
21
  class TokenUpdateResponse < Authlete::Model::Result
26
- # The next action which the caller of the API should take next.
27
- # (String)
22
+
28
23
  attr_accessor :action
29
24
 
30
- # The access token which has been specified by the request. (String)
31
25
  attr_accessor :accessToken
32
26
  alias_method :access_token, :accessToken
33
27
  alias_method :access_token=, :accessToken=
34
28
 
35
- # The date at which the access token will expire. (Integer)
29
+ attr_accessor :tokenType
30
+ alias_method :token_type, :tokenType
31
+ alias_method :token_type=, :tokenType=
32
+
36
33
  attr_accessor :accessTokenExpiresAt
37
34
  alias_method :access_token_expires_at, :accessTokenExpiresAt
38
35
  alias_method :access_token_expires_at=, :accessTokenExpiresAt=
39
36
 
40
- # Extra properties associated with the access token. (Property array)
37
+ attr_accessor :scopes
38
+
41
39
  attr_accessor :properties
42
40
 
43
- # The scopes which is associated with the access token. (String array)
44
- attr_accessor :scopes
41
+ private
42
+
43
+ def defaults
44
+ super.merge(
45
+ action: nil,
46
+ accessToken: nil,
47
+ tokenType: nil,
48
+ accessTokenExpiresAt: 0,
49
+ scopes: nil,
50
+ properties: nil
51
+ )
52
+ end
45
53
 
46
- # The constructor which takes a hash that represents a JSON response
47
- # from /api/auth/token/update API.
48
- def initialize(hash = {})
54
+ def set_params(hash)
49
55
  super(hash)
50
56
 
51
- @action = extract_value(hash, :action)
52
- @accessToken = extract_value(hash, :accessToken)
53
- @accessTokenExpiresAt = extract_integer_value(hash, :accessTokenExpiresAt)
54
- @properties = extract_array_value(hash, :scopes) do |element|
55
- Authlete::Model::Property.parse(element)
56
- end
57
- @scopes = extract_value(hash, :scopes)
57
+ @action = hash[:action]
58
+ @accessToken = hash[:accessToken]
59
+ @tokenType = hash[:tokenType]
60
+ @accessTokenExpiresAt = hash[:accessTokenExpiresAt]
61
+ @scopes = hash[:scopes]
62
+ @properties = get_parsed_array(hash[:properties]) { |e| Authlete::Model::Property.parse(e) }
58
63
  end
59
64
  end
60
65
  end
61
66
  end
62
- end
67
+ 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.
@@ -18,30 +18,30 @@
18
18
  module Authlete
19
19
  module Model
20
20
  module Response
21
- # == Authlete::Model::Response::UserInfoIssueResponse class
22
- #
23
- # A class that represents a response from Authlete's
24
- # /api/auth/userinfo/issue API.
25
21
  class UserInfoIssueResponse < Authlete::Model::Result
26
- # The next action which the caller of the API should take next.
27
- # (String)
22
+
28
23
  attr_accessor :action
29
24
 
30
- # The content of the error response that the service implementation
31
- # should return to the client application. (String)
32
- attr_accessor :response_content
25
+ attr_accessor :responseContent
33
26
  alias_method :response_content, :responseContent
34
27
  alias_method :response_content=, :responseContent=
35
28
 
36
- # The constructor which takes a hash that represents a JSON response
37
- # from /api/auth/userinfo/issue API.
38
- def initialize(hash = {})
29
+ private
30
+
31
+ def defaults
32
+ super.merge(
33
+ action: nil,
34
+ responseContent: nil
35
+ )
36
+ end
37
+
38
+ def set_params(hash)
39
39
  super(hash)
40
40
 
41
- @action = extract_value(hash, :action)
42
- @responseContent = extract_value(hash, :responseContent)
41
+ @action = hash[:action]
42
+ @responseContent = hash[:responseContent]
43
43
  end
44
44
  end
45
45
  end
46
46
  end
47
- end
47
+ 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.
@@ -18,68 +18,74 @@
18
18
  module Authlete
19
19
  module Model
20
20
  module Response
21
- # == Authlete::Model::Response::UserInfoResponse class
22
- #
23
- # A class that represents a response from Authlete's
24
- # /api/auth/userinfo API.
25
21
  class UserInfoResponse < Authlete::Model::Result
26
- # The next action which the caller of the API should take next.
27
- # (String)
28
- attr_accessor :action
29
22
 
30
- # The list of claims that the client application requests to be
31
- # embedded in the ID token. (String array)
32
- attr_accessor :claims
23
+ attr_accessor :action
33
24
 
34
- # The ID of the client application which is associated with
35
- # the access token. (Integer)
36
25
  attr_accessor :clientId
37
26
  alias_method :client_id, :clientId
38
27
  alias_method :client_id=, :clientId=
39
28
 
40
- # The client ID alias when the authorization request for the access
41
- # token was made. (String)
29
+ attr_accessor :subject
30
+
31
+ attr_accessor :scopes
32
+
33
+ attr_accessor :claims
34
+
35
+ attr_accessor :token
36
+
37
+ attr_accessor :responseContent
38
+ alias_method :response_content, :responseContent
39
+ alias_method :response_content=, :responseContent=
40
+
41
+ attr_accessor :properties
42
+
42
43
  attr_accessor :clientIdAlias
43
44
  alias_method :client_id_alias, :clientIdAlias
44
45
  alias_method :client_id_alias=, :clientIdAlias=
45
46
 
46
- # The flag which indicates whether the client ID alias was used when
47
- # the authorization request or the token request for the access token
48
- # was made. (Boolean)
49
47
  attr_accessor :clientIdAliasUsed
50
48
  alias_method :client_id_alias_used, :clientIdAliasUsed
51
49
  alias_method :client_id_alias_used=, :clientIdAliasUsed=
52
50
 
53
- # The content of the error response that the service implementation
54
- # should return to the client application. (String)
55
- attr_accessor :response_content
56
- alias_method :response_content, :responseContent
57
- alias_method :response_content=, :responseContent=
51
+ attr_accessor :userInfoClaims
52
+ alias_method :user_info_claims, :userInfoClaims
53
+ alias_method :user_info_claims=, :userInfoClaims=
58
54
 
59
- # The scopes covered by the access token. (String array)
60
- attr_accessor :scopes
61
-
62
- # The subject (= resource owner's ID). (String)
63
- attr_accessor :subject
55
+ private
64
56
 
65
- # The access token that came along with the userinfo request. (String)
66
- attr_accessor :token
57
+ def defaults
58
+ super.merge(
59
+ action: nil,
60
+ clientId: 0,
61
+ subject: nil,
62
+ scopes: nil,
63
+ claims: nil,
64
+ token: nil,
65
+ responseContent: nil,
66
+ properties: nil,
67
+ clientIdAlias: nil,
68
+ clientIdAliasUsed: false,
69
+ userInfoClaims: nil
70
+ )
71
+ end
67
72
 
68
- # The constructor which takes a hash that represents a JSON response
69
- # from /api/auth/introspection API.
70
- def initialize(hash = {})
73
+ def set_params(hash)
71
74
  super(hash)
72
75
 
73
- @action = extract_value(hash, :action)
74
- @clientId = extract_value(hash, :clientId)
75
- @clientIdAlias = extract_value(hash, :clientIdAlias)
76
- @clientIdAliasUsed = extract_boolean_value(hash, :clientIdAliasUsed)
77
- @responseContent = extract_value(hash, :responseContent)
78
- @scopes = extract_value(hash, :scopes)
79
- @subject = extract_value(hash, :subject)
80
- @token = extract_value(hash, :token)
76
+ @action = hash[:action]
77
+ @clientId = hash[:clientId]
78
+ @subject = hash[:subject]
79
+ @scopes = hash[:scopes]
80
+ @claims = hash[:claims]
81
+ @token = hash[:token]
82
+ @responseContent = hash[:responseContent]
83
+ @properties = get_parsed_array(hash[:properties]) { |e| Authlete::Model::Property.parse(e) }
84
+ @clientIdAlias = hash[:clientIdAlias]
85
+ @clientIdAliasUsed = hash[:clientIdAliasUsed]
86
+ @userInfoClaims = hash[:userInfoClaims]
81
87
  end
82
88
  end
83
89
  end
84
90
  end
85
- end
91
+ end