authlete 1.38.0 → 1.39.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. checksums.yaml +5 -5
  2. data/authlete.gemspec +1 -2
  3. data/lib/authlete/model/service.rb +7 -1
  4. data/lib/authlete/version.rb +1 -1
  5. metadata +7 -170
  6. data/test/authlete/model/request/test_authentication-callback-request.rb +0 -100
  7. data/test/authlete/model/request/test_authorization-fail-request.rb +0 -67
  8. data/test/authlete/model/request/test_authorization-issue-request.rb +0 -94
  9. data/test/authlete/model/request/test_authorization-request.rb +0 -57
  10. data/test/authlete/model/request/test_backchannel-authentication-complete-request.rb +0 -102
  11. data/test/authlete/model/request/test_backchannel-authentication-fail-request.rb +0 -71
  12. data/test/authlete/model/request/test_backchannel-authentication-issue-request.rb +0 -57
  13. data/test/authlete/model/request/test_backchannel-authentication-request.rb +0 -75
  14. data/test/authlete/model/request/test_client-authorization-delete-request.rb +0 -57
  15. data/test/authlete/model/request/test_client-authorization-get-list-request.rb +0 -71
  16. data/test/authlete/model/request/test_client-authorization-update-request.rb +0 -63
  17. data/test/authlete/model/request/test_client-registration-request.rb +0 -68
  18. data/test/authlete/model/request/test_device-authorization-request.rb +0 -75
  19. data/test/authlete/model/request/test_device-complete-request.rb +0 -102
  20. data/test/authlete/model/request/test_device-verification-request.rb +0 -57
  21. data/test/authlete/model/request/test_granted-scopes-request.rb +0 -57
  22. data/test/authlete/model/request/test_introspection-request.rb +0 -79
  23. data/test/authlete/model/request/test_pushed-auth-req-request.rb +0 -75
  24. data/test/authlete/model/request/test_revocation-request.rb +0 -67
  25. data/test/authlete/model/request/test_standard-introspection-request.rb +0 -57
  26. data/test/authlete/model/request/test_token-create-request.rb +0 -110
  27. data/test/authlete/model/request/test_token-fail-request.rb +0 -63
  28. data/test/authlete/model/request/test_token-issue-request.rb +0 -70
  29. data/test/authlete/model/request/test_token-request.rb +0 -94
  30. data/test/authlete/model/request/test_token-revoke-request.rb +0 -71
  31. data/test/authlete/model/request/test_token-update-request.rb +0 -82
  32. data/test/authlete/model/request/test_user-info-issue-request.rb +0 -67
  33. data/test/authlete/model/request/test_user-info-request.rb +0 -75
  34. data/test/authlete/model/response/test_access-token.rb +0 -101
  35. data/test/authlete/model/response/test_authorization-fail-response.rb +0 -68
  36. data/test/authlete/model/response/test_authorization-issue-response.rb +0 -92
  37. data/test/authlete/model/response/test_authorization-response.rb +0 -145
  38. data/test/authlete/model/response/test_authorized-client-list-response.rb +0 -83
  39. data/test/authlete/model/response/test_backchannel-authentication-complete-response.rb +0 -132
  40. data/test/authlete/model/response/test_backchannel-authentication-fail-response.rb +0 -68
  41. data/test/authlete/model/response/test_backchannel-authentication-issue-response.rb +0 -80
  42. data/test/authlete/model/response/test_backchannel-authentication-response.rb +0 -156
  43. data/test/authlete/model/response/test_client-list-response.rb +0 -79
  44. data/test/authlete/model/response/test_client-secret-refresh-response.rb +0 -68
  45. data/test/authlete/model/response/test_client-secret-update-response.rb +0 -68
  46. data/test/authlete/model/response/test_device-authorization-response.rb +0 -140
  47. data/test/authlete/model/response/test_device-complete-response.rb +0 -64
  48. data/test/authlete/model/response/test_device-verification-response.rb +0 -112
  49. data/test/authlete/model/response/test_granted-scopes-get-response.rb +0 -84
  50. data/test/authlete/model/response/test_introspection-response.rb +0 -127
  51. data/test/authlete/model/response/test_pushed-auth-req-response.rb +0 -76
  52. data/test/authlete/model/response/test_revocation-response.rb +0 -68
  53. data/test/authlete/model/response/test_service-list-response.rb +0 -72
  54. data/test/authlete/model/response/test_standard-introspection-response.rb +0 -68
  55. data/test/authlete/model/response/test_token-create-response.rb +0 -107
  56. data/test/authlete/model/response/test_token-fail-response.rb +0 -68
  57. data/test/authlete/model/response/test_token-issue-response.rb +0 -127
  58. data/test/authlete/model/response/test_token-list-response.rb +0 -84
  59. data/test/authlete/model/response/test_token-response.rb +0 -147
  60. data/test/authlete/model/response/test_token-revoke-response.rb +0 -63
  61. data/test/authlete/model/response/test_token-update-response.rb +0 -87
  62. data/test/authlete/model/response/test_user-info-issue-response.rb +0 -68
  63. data/test/authlete/model/response/test_user-info-response.rb +0 -107
  64. data/test/authlete/model/test_client-extension.rb +0 -98
  65. data/test/authlete/model/test_client.rb +0 -604
  66. data/test/authlete/model/test_hsk.rb +0 -108
  67. data/test/authlete/model/test_named-uri.rb +0 -83
  68. data/test/authlete/model/test_pair.rb +0 -83
  69. data/test/authlete/model/test_property.rb +0 -88
  70. data/test/authlete/model/test_result.rb +0 -68
  71. data/test/authlete/model/test_scope.rb +0 -104
  72. data/test/authlete/model/test_service-owner.rb +0 -80
  73. data/test/authlete/model/test_service.rb +0 -896
  74. data/test/authlete/model/test_sns-credentials.rb +0 -88
  75. data/test/authlete/model/test_tagged-value.rb +0 -83
  76. data/test/authlete/model/test_trust-anchor.rb +0 -84
  77. data/test/authlete/test_exception.rb +0 -70
  78. data/test/authlete/types/test_application-type.rb +0 -44
  79. data/test/authlete/types/test_client-auth-method.rb +0 -64
  80. data/test/authlete/types/test_delivery-mode.rb +0 -48
  81. data/test/authlete/types/test_grant-type.rb +0 -72
  82. data/test/authlete/types/test_jwealg.rb +0 -104
  83. data/test/authlete/types/test_jweenc.rb +0 -60
  84. data/test/authlete/types/test_jwsalg.rb +0 -96
  85. data/test/authlete/types/test_response-type.rb +0 -68
  86. data/test/authlete/types/test_subject-type.rb +0 -44
@@ -1,70 +0,0 @@
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
- require 'authlete'
19
- require 'minitest/autorun'
20
-
21
-
22
- class TokenIssueRequestTest < Minitest::Test
23
- TICKET = '<ticket>'
24
- SUBJECT = '<subject>'
25
- PROPERTY_KEY = '<property0-key>'
26
- PROPERTY_VALUE = '<property0-value>'
27
- PROPERTIES = [ Authlete::Model::Property.new(key: PROPERTY_KEY, value: PROPERTY_VALUE) ]
28
-
29
-
30
- def set_params(obj)
31
- obj.ticket = TICKET
32
- obj.subject = SUBJECT
33
- obj.properties = PROPERTIES
34
- end
35
-
36
-
37
- def match(obj)
38
- assert_equal TICKET, obj.ticket
39
- assert_equal SUBJECT, obj.subject
40
- assert_equal PROPERTY_KEY, obj.properties[0].key
41
- assert_equal PROPERTY_VALUE, obj.properties[0].value
42
- end
43
-
44
-
45
- def generate_hash
46
- {
47
- ticket: '<ticket>',
48
- subject: '<subject>',
49
- properties: [ { key: '<property0-key>', value: '<property0-value>', hidden: false } ],
50
- }
51
- end
52
-
53
-
54
- def test_setters
55
- actual = Authlete::Model::Request::TokenIssueRequest.new
56
- set_params(actual)
57
-
58
- match(actual)
59
- end
60
-
61
-
62
- def test_to_hash
63
- obj = Authlete::Model::Request::TokenIssueRequest.new
64
- set_params(obj)
65
- actual = obj.to_hash
66
- expected = generate_hash
67
-
68
- assert_equal expected, actual
69
- end
70
- end
@@ -1,94 +0,0 @@
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
- require 'authlete'
19
- require 'minitest/autorun'
20
-
21
-
22
- class TokenRequestTest < Minitest::Test
23
- PARAMETERS = '<parameters>'
24
- CLIENT_ID = '<client-id>'
25
- CLIENT_SECRET = '<client-secret>'
26
- PROPERTY_KEY = '<property0-key>'
27
- PROPERTY_VALUE = '<property0-value>'
28
- PROPERTIES = [ Authlete::Model::Property.new(key: PROPERTY_KEY, value: PROPERTY_VALUE) ]
29
- CLIENT_CERTIFICATE = '<client-certificate>'
30
- CLIENT_CERTIFICATE_PATH = [ 'path0', 'path1' ]
31
- DPOP = '<dpop>'
32
- HTU = '<htu>'
33
- HTM = '<htm>'
34
-
35
-
36
- def set_params(obj)
37
- obj.parameters = PARAMETERS
38
- obj.client_id = CLIENT_ID
39
- obj.client_secret = CLIENT_SECRET
40
- obj.properties = PROPERTIES
41
- obj.client_certificate = CLIENT_CERTIFICATE
42
- obj.client_certificate_path = CLIENT_CERTIFICATE_PATH
43
- obj.dpop = DPOP
44
- obj.htu = HTU
45
- obj.htm = HTM
46
- end
47
-
48
-
49
- def match(obj)
50
- assert_equal PARAMETERS, obj.parameters
51
- assert_equal CLIENT_ID, obj.clientId
52
- assert_equal CLIENT_SECRET, obj.clientSecret
53
- assert_equal PROPERTY_KEY, obj.properties[0].key
54
- assert_equal PROPERTY_VALUE, obj.properties[0].value
55
- assert_equal CLIENT_CERTIFICATE, obj.clientCertificate
56
- assert_equal CLIENT_CERTIFICATE_PATH, obj.clientCertificatePath
57
- assert_equal DPOP, obj.dpop
58
- assert_equal HTU, obj.htu
59
- assert_equal HTM, obj.htm
60
- end
61
-
62
-
63
- def generate_hash
64
- {
65
- parameters: '<parameters>',
66
- clientId: '<client-id>',
67
- clientSecret: '<client-secret>',
68
- properties: [ { key: '<property0-key>', value: '<property0-value>', hidden: false } ],
69
- clientCertificate: '<client-certificate>',
70
- clientCertificatePath: [ 'path0', 'path1' ],
71
- dpop: '<dpop>',
72
- htu: '<htu>',
73
- htm: '<htm>'
74
- }
75
- end
76
-
77
-
78
- def test_setters
79
- actual = Authlete::Model::Request::TokenRequest.new
80
- set_params(actual)
81
-
82
- match(actual)
83
- end
84
-
85
-
86
- def test_to_hash
87
- obj = Authlete::Model::Request::TokenRequest.new
88
- set_params(obj)
89
- actual = obj.to_hash
90
- expected = generate_hash
91
-
92
- assert_equal expected, actual
93
- end
94
- end
@@ -1,71 +0,0 @@
1
- # :nodoc:
2
- #
3
- # Copyright (C) 2014-2024 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
- require 'authlete'
19
- require 'minitest/autorun'
20
-
21
-
22
- class TokenRevokeRequestTest < Minitest::Test
23
- ACCESS_TOKEN_IDENTIFIER = '<access-token-identifier>'
24
- CLIENT_IDENTIFIER = '<client-identifier>'
25
- REFRESH_TOKEN_IDENTIFIER = '<refresh-token-identifier>'
26
- SUBJECT = '<subject>'
27
-
28
-
29
- def set_params(obj)
30
- obj.access_token_identifier = ACCESS_TOKEN_IDENTIFIER
31
- obj.client_identifier = CLIENT_IDENTIFIER
32
- obj.refresh_token_identifier = REFRESH_TOKEN_IDENTIFIER
33
- obj.subject = SUBJECT
34
- end
35
-
36
-
37
- def match(obj)
38
- assert_equal ACCESS_TOKEN_IDENTIFIER, obj.access_token_identifier
39
- assert_equal CLIENT_IDENTIFIER, obj.client_identifier
40
- assert_equal REFRESH_TOKEN_IDENTIFIER, obj.refresh_token_identifier
41
- assert_equal SUBJECT, obj.subject
42
- end
43
-
44
-
45
- def generate_hash
46
- {
47
- accessTokenIdentifier: '<access-token-identifier>',
48
- clientIdentifier: '<client-identifier>',
49
- refreshTokenIentifier: '<refresh-token-identifier>',
50
- subject: '<subject>'
51
- }
52
- end
53
-
54
-
55
- def test_setters
56
- actual = Authlete::Model::Request::TokenRevokeRequest.new
57
- set_params(actual)
58
-
59
- match(actual)
60
- end
61
-
62
-
63
- def test_to_hash
64
- obj = Authlete::Model::Request::TokenRevokeRequest.new
65
- set_params(obj)
66
- actual = obj.to_hash
67
- expected = generate_hash
68
-
69
- assert_equal expected, actual
70
- end
71
- end
@@ -1,82 +0,0 @@
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
- require 'authlete'
19
- require 'minitest/autorun'
20
-
21
-
22
- class TokenUpdateRequestTest < Minitest::Test
23
- ACCESS_TOKEN = '<access-token>'
24
- ACCESS_TOKEN_EXPIRES_AT = 1000
25
- SCOPES = [ 'scope0', 'scope1' ]
26
- PROPERTY_KEY = '<property0-key>'
27
- PROPERTY_VALUE = '<property0-value>'
28
- PROPERTIES = [ Authlete::Model::Property.new(key: PROPERTY_KEY, value: PROPERTY_VALUE) ]
29
- CERTIFICATE_THUMBPRINT = '<certificate-thumbprint>'
30
- DPOP_KEY_THUMBPRINT = '<dpop-key-thumbprint>'
31
-
32
-
33
- def set_params(obj)
34
- obj.access_token = ACCESS_TOKEN
35
- obj.access_token_expires_at = ACCESS_TOKEN_EXPIRES_AT
36
- obj.scopes = SCOPES
37
- obj.properties = PROPERTIES
38
- obj.certificate_thumbprint = CERTIFICATE_THUMBPRINT
39
- obj.dpop_key_thumbprint = DPOP_KEY_THUMBPRINT
40
- end
41
-
42
-
43
- def match(obj)
44
- assert_equal ACCESS_TOKEN, obj.accessToken
45
- assert_equal ACCESS_TOKEN_EXPIRES_AT, obj.accessTokenExpiresAt
46
- assert_equal SCOPES, obj.scopes
47
- assert_equal PROPERTY_KEY, obj.properties[0].key
48
- assert_equal PROPERTY_VALUE, obj.properties[0].value
49
- assert_equal CERTIFICATE_THUMBPRINT, obj.certificateThumbprint
50
- assert_equal DPOP_KEY_THUMBPRINT, obj.dpopKeyThumbprint
51
- end
52
-
53
-
54
- def generate_hash
55
- {
56
- accessToken: '<access-token>',
57
- accessTokenExpiresAt: 1000,
58
- scopes: [ 'scope0', 'scope1' ],
59
- properties: [ { key: '<property0-key>', value: '<property0-value>', hidden: false } ],
60
- certificateThumbprint: '<certificate-thumbprint>',
61
- dpopKeyThumbprint: '<dpop-key-thumbprint>'
62
- }
63
- end
64
-
65
-
66
- def test_setters
67
- actual = Authlete::Model::Request::TokenUpdateRequest.new
68
- set_params(actual)
69
-
70
- match(actual)
71
- end
72
-
73
-
74
- def test_to_hash
75
- obj = Authlete::Model::Request::TokenUpdateRequest.new
76
- set_params(obj)
77
- actual = obj.to_hash
78
- expected = generate_hash
79
-
80
- assert_equal expected, actual
81
- end
82
- end
@@ -1,67 +0,0 @@
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
- require 'authlete'
19
- require 'minitest/autorun'
20
-
21
-
22
- class UserInfoIssueRequestTest < Minitest::Test
23
- TOKEN = '<token>'
24
- CLAIMS = [ 'claim0', 'claim1' ]
25
- SUB = '<sub>'
26
-
27
-
28
- def set_params(obj)
29
- obj.token = TOKEN
30
- obj.claims = CLAIMS
31
- obj.sub = SUB
32
- end
33
-
34
-
35
- def match(obj)
36
- assert_equal TOKEN, obj.token
37
- assert_equal CLAIMS, obj.claims
38
- assert_equal SUB, obj.sub
39
- end
40
-
41
-
42
- def generate_hash
43
- {
44
- token: '<token>',
45
- claims: [ 'claim0', 'claim1' ],
46
- sub: '<sub>'
47
- }
48
- end
49
-
50
-
51
- def test_setters
52
- actual = Authlete::Model::Request::UserInfoIssueRequest.new
53
- set_params(actual)
54
-
55
- match(actual)
56
- end
57
-
58
-
59
- def test_to_hash
60
- obj = Authlete::Model::Request::UserInfoIssueRequest.new
61
- set_params(obj)
62
- actual = obj.to_hash
63
- expected = generate_hash
64
-
65
- assert_equal expected, actual
66
- end
67
- end
@@ -1,75 +0,0 @@
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
- require 'authlete'
19
- require 'minitest/autorun'
20
-
21
-
22
- class UserInfoRequestTest < Minitest::Test
23
- TOKEN = '<token>'
24
- CLIENT_CERTIFICATE = '<client-certificate>'
25
- DPOP = '<dpop>'
26
- HTU = '<htu>'
27
- HTM = '<htm>'
28
-
29
-
30
- def set_params(obj)
31
- obj.token = TOKEN
32
- obj.client_certificate = CLIENT_CERTIFICATE
33
- obj.dpop = DPOP
34
- obj.htu = HTU
35
- obj.htm = HTM
36
- end
37
-
38
-
39
- def match(obj)
40
- assert_equal TOKEN, obj.token
41
- assert_equal CLIENT_CERTIFICATE, obj.clientCertificate
42
- assert_equal DPOP, obj.dpop
43
- assert_equal HTU, obj.htu
44
- assert_equal HTM, obj.htm
45
- end
46
-
47
-
48
- def generate_hash
49
- {
50
- token: '<token>',
51
- clientCertificate: '<client-certificate>',
52
- dpop: '<dpop>',
53
- htu: '<htu>',
54
- htm: '<htm>'
55
- }
56
- end
57
-
58
-
59
- def test_setters
60
- actual = Authlete::Model::Request::UserInfoRequest.new
61
- set_params(actual)
62
-
63
- match(actual)
64
- end
65
-
66
-
67
- def test_to_hash
68
- obj = Authlete::Model::Request::UserInfoRequest.new
69
- set_params(obj)
70
- actual = obj.to_hash
71
- expected = generate_hash
72
-
73
- assert_equal expected, actual
74
- end
75
- end
@@ -1,101 +0,0 @@
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
- require 'authlete'
19
- require 'json'
20
- require 'minitest/autorun'
21
-
22
-
23
- class AccessTokenTest < Minitest::Test
24
- ACCESS_TOKEN_HASH = '<access-token-hash>'
25
- REFRESH_TOKEN_HASH = '<refresh-token-hash>'
26
- CLIENT_ID = 12345
27
- SUBJECT = '<subject>'
28
- GRANT_TYPE = 'AUTHORIZATION_CODE'
29
- SCOPES = [ 'scope0', 'scope1' ]
30
- ACCESS_TOKEN_EXPIRES_AT = 1000
31
- REFRESH_TOKEN_EXPIRES_AT = 1000
32
- CREATED_AT = 10000
33
- LAST_REFRESHED_AT = 10000
34
- PROPERTY_KEY = '<property0-key>'
35
- PROPERTY_VALUE = '<property0-value>'
36
- PROPERTY_HIDDEN = true
37
- PROPERTIES = [ Authlete::Model::Property.new(key: PROPERTY_KEY, value: PROPERTY_VALUE, hidden: PROPERTY_HIDDEN) ]
38
-
39
-
40
- def generate_json
41
- return <<~JSON
42
- {
43
- "accessTokenHash": "<access-token-hash>",
44
- "refreshTokenHash": "<refresh-token-hash>",
45
- "clientId": 12345,
46
- "subject": "<subject>",
47
- "grantType": "AUTHORIZATION_CODE",
48
- "scopes": [ "scope0", "scope1" ],
49
- "accessTokenExpiresAt": 1000,
50
- "refreshTokenExpiresAt": 1000,
51
- "createdAt": 10000,
52
- "lastRefreshedAt": 10000,
53
- "properties": [ { "key": "<property0-key>", "value": "<property0-value>", "hidden": true } ]
54
- }
55
- JSON
56
- end
57
-
58
-
59
- def match(obj)
60
- assert_equal ACCESS_TOKEN_HASH, obj.accessTokenHash
61
- assert_equal REFRESH_TOKEN_HASH, obj.refreshTokenHash
62
- assert_equal CLIENT_ID, obj.clientId
63
- assert_equal SUBJECT, obj.subject
64
- assert_equal GRANT_TYPE, obj.grantType
65
- assert_equal SCOPES, obj.scopes
66
- assert_equal ACCESS_TOKEN_EXPIRES_AT, obj.accessTokenExpiresAt
67
- assert_equal REFRESH_TOKEN_EXPIRES_AT, obj.refreshTokenExpiresAt
68
- assert_equal CREATED_AT, obj.createdAt
69
- assert_equal LAST_REFRESHED_AT, obj.lastRefreshedAt
70
- assert_equal PROPERTY_KEY, obj.properties[0].key
71
- assert_equal PROPERTY_VALUE, obj.properties[0].value
72
- assert_equal PROPERTY_HIDDEN, obj.properties[0].hidden
73
- end
74
-
75
-
76
- def test_from_json
77
- jsn = generate_json
78
- hsh = JSON.parse(jsn)
79
- actual = Authlete::Model::Response::AccessToken.new(hsh)
80
-
81
- match(actual)
82
- end
83
-
84
-
85
- def test_setters
86
- actual = Authlete::Model::Response::AccessToken.new
87
- actual.access_token_hash = ACCESS_TOKEN_HASH
88
- actual.refresh_token_hash = REFRESH_TOKEN_HASH
89
- actual.client_id = CLIENT_ID
90
- actual.subject = SUBJECT
91
- actual.grant_type = GRANT_TYPE
92
- actual.scopes = SCOPES
93
- actual.access_token_expires_at = ACCESS_TOKEN_EXPIRES_AT
94
- actual.refresh_token_expires_at = REFRESH_TOKEN_EXPIRES_AT
95
- actual.created_at = CREATED_AT
96
- actual.last_refreshed_at = LAST_REFRESHED_AT
97
- actual.properties = PROPERTIES
98
-
99
- match(actual)
100
- end
101
- end
@@ -1,68 +0,0 @@
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
- require 'authlete'
19
- require 'json'
20
- require 'minitest/autorun'
21
-
22
-
23
- class AuthorizationFailResponseTest < Minitest::Test
24
- RESULT_CODE = '<result-code>'
25
- RESULT_MESSAGE = '<result-message>'
26
- ACTION = 'LOCATION'
27
- RESPONSE_CONTENT = '<response-content>'
28
-
29
-
30
- def generate_json
31
- return <<~JSON
32
- {
33
- "resultCode": "<result-code>",
34
- "resultMessage": "<result-message>",
35
- "action": "LOCATION",
36
- "responseContent": "<response-content>"
37
- }
38
- JSON
39
- end
40
-
41
-
42
- def match(obj)
43
- assert_equal RESULT_CODE, obj.resultCode
44
- assert_equal RESULT_MESSAGE, obj.resultMessage
45
- assert_equal ACTION, obj.action
46
- assert_equal RESPONSE_CONTENT, obj.responseContent
47
- end
48
-
49
-
50
- def test_from_json
51
- jsn = generate_json
52
- hsh = JSON.parse(jsn)
53
- actual = Authlete::Model::Response::AuthorizationFailResponse.new(hsh)
54
-
55
- match(actual)
56
- end
57
-
58
-
59
- def test_setters
60
- actual = Authlete::Model::Response::AuthorizationFailResponse.new
61
- actual.result_code = RESULT_CODE
62
- actual.result_message = RESULT_MESSAGE
63
- actual.action = ACTION
64
- actual.response_content = RESPONSE_CONTENT
65
-
66
- match(actual)
67
- end
68
- end