authlete 1.38.0 → 1.40.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (90) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +38 -0
  3. data/authlete.gemspec +1 -2
  4. data/lib/authlete/api.rb +17 -0
  5. data/lib/authlete/logging.rb +94 -0
  6. data/lib/authlete/model/service.rb +7 -1
  7. data/lib/authlete/version.rb +1 -1
  8. data/lib/authlete.rb +3 -0
  9. metadata +5 -167
  10. data/test/authlete/model/request/test_authentication-callback-request.rb +0 -100
  11. data/test/authlete/model/request/test_authorization-fail-request.rb +0 -67
  12. data/test/authlete/model/request/test_authorization-issue-request.rb +0 -94
  13. data/test/authlete/model/request/test_authorization-request.rb +0 -57
  14. data/test/authlete/model/request/test_backchannel-authentication-complete-request.rb +0 -102
  15. data/test/authlete/model/request/test_backchannel-authentication-fail-request.rb +0 -71
  16. data/test/authlete/model/request/test_backchannel-authentication-issue-request.rb +0 -57
  17. data/test/authlete/model/request/test_backchannel-authentication-request.rb +0 -75
  18. data/test/authlete/model/request/test_client-authorization-delete-request.rb +0 -57
  19. data/test/authlete/model/request/test_client-authorization-get-list-request.rb +0 -71
  20. data/test/authlete/model/request/test_client-authorization-update-request.rb +0 -63
  21. data/test/authlete/model/request/test_client-registration-request.rb +0 -68
  22. data/test/authlete/model/request/test_device-authorization-request.rb +0 -75
  23. data/test/authlete/model/request/test_device-complete-request.rb +0 -102
  24. data/test/authlete/model/request/test_device-verification-request.rb +0 -57
  25. data/test/authlete/model/request/test_granted-scopes-request.rb +0 -57
  26. data/test/authlete/model/request/test_introspection-request.rb +0 -79
  27. data/test/authlete/model/request/test_pushed-auth-req-request.rb +0 -75
  28. data/test/authlete/model/request/test_revocation-request.rb +0 -67
  29. data/test/authlete/model/request/test_standard-introspection-request.rb +0 -57
  30. data/test/authlete/model/request/test_token-create-request.rb +0 -110
  31. data/test/authlete/model/request/test_token-fail-request.rb +0 -63
  32. data/test/authlete/model/request/test_token-issue-request.rb +0 -70
  33. data/test/authlete/model/request/test_token-request.rb +0 -94
  34. data/test/authlete/model/request/test_token-revoke-request.rb +0 -71
  35. data/test/authlete/model/request/test_token-update-request.rb +0 -82
  36. data/test/authlete/model/request/test_user-info-issue-request.rb +0 -67
  37. data/test/authlete/model/request/test_user-info-request.rb +0 -75
  38. data/test/authlete/model/response/test_access-token.rb +0 -101
  39. data/test/authlete/model/response/test_authorization-fail-response.rb +0 -68
  40. data/test/authlete/model/response/test_authorization-issue-response.rb +0 -92
  41. data/test/authlete/model/response/test_authorization-response.rb +0 -145
  42. data/test/authlete/model/response/test_authorized-client-list-response.rb +0 -83
  43. data/test/authlete/model/response/test_backchannel-authentication-complete-response.rb +0 -132
  44. data/test/authlete/model/response/test_backchannel-authentication-fail-response.rb +0 -68
  45. data/test/authlete/model/response/test_backchannel-authentication-issue-response.rb +0 -80
  46. data/test/authlete/model/response/test_backchannel-authentication-response.rb +0 -156
  47. data/test/authlete/model/response/test_client-list-response.rb +0 -79
  48. data/test/authlete/model/response/test_client-secret-refresh-response.rb +0 -68
  49. data/test/authlete/model/response/test_client-secret-update-response.rb +0 -68
  50. data/test/authlete/model/response/test_device-authorization-response.rb +0 -140
  51. data/test/authlete/model/response/test_device-complete-response.rb +0 -64
  52. data/test/authlete/model/response/test_device-verification-response.rb +0 -112
  53. data/test/authlete/model/response/test_granted-scopes-get-response.rb +0 -84
  54. data/test/authlete/model/response/test_introspection-response.rb +0 -127
  55. data/test/authlete/model/response/test_pushed-auth-req-response.rb +0 -76
  56. data/test/authlete/model/response/test_revocation-response.rb +0 -68
  57. data/test/authlete/model/response/test_service-list-response.rb +0 -72
  58. data/test/authlete/model/response/test_standard-introspection-response.rb +0 -68
  59. data/test/authlete/model/response/test_token-create-response.rb +0 -107
  60. data/test/authlete/model/response/test_token-fail-response.rb +0 -68
  61. data/test/authlete/model/response/test_token-issue-response.rb +0 -127
  62. data/test/authlete/model/response/test_token-list-response.rb +0 -84
  63. data/test/authlete/model/response/test_token-response.rb +0 -147
  64. data/test/authlete/model/response/test_token-revoke-response.rb +0 -63
  65. data/test/authlete/model/response/test_token-update-response.rb +0 -87
  66. data/test/authlete/model/response/test_user-info-issue-response.rb +0 -68
  67. data/test/authlete/model/response/test_user-info-response.rb +0 -107
  68. data/test/authlete/model/test_client-extension.rb +0 -98
  69. data/test/authlete/model/test_client.rb +0 -604
  70. data/test/authlete/model/test_hsk.rb +0 -108
  71. data/test/authlete/model/test_named-uri.rb +0 -83
  72. data/test/authlete/model/test_pair.rb +0 -83
  73. data/test/authlete/model/test_property.rb +0 -88
  74. data/test/authlete/model/test_result.rb +0 -68
  75. data/test/authlete/model/test_scope.rb +0 -104
  76. data/test/authlete/model/test_service-owner.rb +0 -80
  77. data/test/authlete/model/test_service.rb +0 -896
  78. data/test/authlete/model/test_sns-credentials.rb +0 -88
  79. data/test/authlete/model/test_tagged-value.rb +0 -83
  80. data/test/authlete/model/test_trust-anchor.rb +0 -84
  81. data/test/authlete/test_exception.rb +0 -70
  82. data/test/authlete/types/test_application-type.rb +0 -44
  83. data/test/authlete/types/test_client-auth-method.rb +0 -64
  84. data/test/authlete/types/test_delivery-mode.rb +0 -48
  85. data/test/authlete/types/test_grant-type.rb +0 -72
  86. data/test/authlete/types/test_jwealg.rb +0 -104
  87. data/test/authlete/types/test_jweenc.rb +0 -60
  88. data/test/authlete/types/test_jwsalg.rb +0 -96
  89. data/test/authlete/types/test_response-type.rb +0 -68
  90. data/test/authlete/types/test_subject-type.rb +0 -44
@@ -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 UserInfoIssueResponseTest < Minitest::Test
24
- RESULT_CODE = '<result-code>'
25
- RESULT_MESSAGE = '<result-message>'
26
- ACTION = 'JWT'
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": "JWT",
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::UserInfoIssueResponse.new(hsh)
54
-
55
- match(actual)
56
- end
57
-
58
-
59
- def test_setters
60
- actual = Authlete::Model::Response::UserInfoIssueResponse.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
@@ -1,107 +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 UserInfoResponseTest < Minitest::Test
24
- RESULT_CODE = '<result-code>'
25
- RESULT_MESSAGE = '<result-message>'
26
- ACTION = 'OK'
27
- CLIENT_ID = 12345
28
- SUBJECT = '<subject>'
29
- SCOPES = [ 'scope0', 'scope1' ]
30
- CLAIMS = [ 'claim0', 'claim1' ]
31
- TOKEN = '<token>'
32
- RESPONSE_CONTENT = '<response-content>'
33
- PROPERTY_KEY = '<property0-key>'
34
- PROPERTY_VALUE = '<property0-value>'
35
- PROPERTIES = [ Authlete::Model::Property.new(key: PROPERTY_KEY, value: PROPERTY_VALUE) ]
36
- CLIENT_ID_ALIAS = '<client-id-alias>'
37
- CLIENT_ID_ALIAS_USED = true
38
- USER_INFO_CLAIMS = '<user-info-claims>'
39
-
40
-
41
- def generate_json
42
- return <<~JSON
43
- {
44
- "resultCode": "<result-code>",
45
- "resultMessage": "<result-message>",
46
- "action": "OK",
47
- "clientId": 12345,
48
- "subject": "<subject>",
49
- "scopes": [ "scope0", "scope1" ],
50
- "claims": [ "claim0", "claim1" ],
51
- "token": "<token>",
52
- "responseContent": "<response-content>",
53
- "properties": [ { "key": "<property0-key>", "value": "<property0-value>" } ],
54
- "clientIdAlias": "<client-id-alias>",
55
- "clientIdAliasUsed": true,
56
- "userInfoClaims": "<user-info-claims>"
57
- }
58
- JSON
59
- end
60
-
61
-
62
- def match(obj)
63
- assert_equal RESULT_CODE, obj.resultCode
64
- assert_equal RESULT_MESSAGE, obj.resultMessage
65
- assert_equal ACTION, obj.action
66
- assert_equal CLIENT_ID, obj.clientId
67
- assert_equal SUBJECT, obj.subject
68
- assert_equal SCOPES, obj.scopes
69
- assert_equal CLAIMS, obj.claims
70
- assert_equal TOKEN, obj.token
71
- assert_equal RESPONSE_CONTENT, obj.responseContent
72
- assert_equal PROPERTY_KEY, obj.properties[0].key
73
- assert_equal PROPERTY_VALUE, obj.properties[0].value
74
- assert_equal CLIENT_ID_ALIAS, obj.clientIdAlias
75
- assert_equal CLIENT_ID_ALIAS_USED, obj.clientIdAliasUsed
76
- assert_equal USER_INFO_CLAIMS, obj.userInfoClaims
77
- end
78
-
79
-
80
- def test_from_json
81
- jsn = generate_json
82
- hsh = JSON.parse(jsn)
83
- actual = Authlete::Model::Response::UserInfoResponse.new(hsh)
84
-
85
- match(actual)
86
- end
87
-
88
-
89
- def test_setters
90
- actual = Authlete::Model::Response::UserInfoResponse.new
91
- actual.result_code = RESULT_CODE
92
- actual.result_message = RESULT_MESSAGE
93
- actual.action = ACTION
94
- actual.client_id = CLIENT_ID
95
- actual.subject = SUBJECT
96
- actual.scopes = SCOPES
97
- actual.claims = CLAIMS
98
- actual.token = TOKEN
99
- actual.response_content = RESPONSE_CONTENT
100
- actual.properties = PROPERTIES
101
- actual.client_id_alias = CLIENT_ID_ALIAS
102
- actual.client_id_alias_used = CLIENT_ID_ALIAS_USED
103
- actual.user_info_claims = USER_INFO_CLAIMS
104
-
105
- match(actual)
106
- end
107
- end
@@ -1,98 +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 ClientExtensionTest < Minitest::Test
24
- REQUESTABLE_SCOPES = %w(<requestable-scope0> <requestable-scope1>)
25
- REQUESTABLE_SCOPES_ENABLED = true
26
- ACCESS_TOKEN_DURATION = 10000
27
- REFRESH_TOKEN_DURATION = 10000
28
- TOKEN_EXCHANGE_PERMITTED = false
29
-
30
-
31
- def generate_json
32
- return <<~JSON
33
- {
34
- "requestableScopes": [ "<requestable-scope0>", "<requestable-scope1>" ],
35
- "requestableScopesEnabled": true,
36
- "accessTokenDuration": 10000,
37
- "refreshTokenDuration": 10000,
38
- "tokenExchangePermitted": false
39
- }
40
- JSON
41
- end
42
-
43
-
44
- def generate_hash
45
- {
46
- requestableScopes: %w(<requestable-scope0> <requestable-scope1>),
47
- requestableScopesEnabled: true,
48
- accessTokenDuration: 10000,
49
- refreshTokenDuration: 10000,
50
- tokenExchangePermitted: false
51
- }
52
- end
53
-
54
-
55
- def set_params(obj)
56
- obj.requestable_scopes = REQUESTABLE_SCOPES
57
- obj.requestable_scopes_enabled = REQUESTABLE_SCOPES_ENABLED
58
- obj.access_token_duration = ACCESS_TOKEN_DURATION
59
- obj.refresh_token_duration = REFRESH_TOKEN_DURATION
60
- obj.token_exchange_permitted = TOKEN_EXCHANGE_PERMITTED
61
- end
62
-
63
-
64
- def match(obj)
65
- assert_equal REQUESTABLE_SCOPES, obj.requestableScopes
66
- assert_equal REQUESTABLE_SCOPES_ENABLED, obj.requestableScopesEnabled
67
- assert_equal ACCESS_TOKEN_DURATION, obj.accessTokenDuration
68
- assert_equal REFRESH_TOKEN_DURATION, obj.refreshTokenDuration
69
- assert_equal TOKEN_EXCHANGE_PERMITTED, obj.tokenExchangePermitted
70
- end
71
-
72
-
73
- def test_from_json
74
- jsn = generate_json
75
- hsh = JSON.parse(jsn)
76
- actual = Authlete::Model::ClientExtension.new(hsh)
77
-
78
- match(actual)
79
- end
80
-
81
-
82
- def test_setters
83
- actual = Authlete::Model::ClientExtension.new
84
- set_params(actual)
85
-
86
- match(actual)
87
- end
88
-
89
-
90
- def test_to_hash
91
- obj = Authlete::Model::ClientExtension.new
92
- set_params(obj)
93
- actual = obj.to_hash
94
- expected = generate_hash
95
-
96
- assert_equal expected, actual
97
- end
98
- end