authlete 1.37.0 → 1.39.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/authlete.gemspec +1 -2
- data/lib/authlete/model/service.rb +7 -1
- data/lib/authlete/version.rb +1 -1
- metadata +7 -170
- data/test/authlete/model/request/test_authentication-callback-request.rb +0 -100
- data/test/authlete/model/request/test_authorization-fail-request.rb +0 -67
- data/test/authlete/model/request/test_authorization-issue-request.rb +0 -94
- data/test/authlete/model/request/test_authorization-request.rb +0 -57
- data/test/authlete/model/request/test_backchannel-authentication-complete-request.rb +0 -102
- data/test/authlete/model/request/test_backchannel-authentication-fail-request.rb +0 -71
- data/test/authlete/model/request/test_backchannel-authentication-issue-request.rb +0 -57
- data/test/authlete/model/request/test_backchannel-authentication-request.rb +0 -75
- data/test/authlete/model/request/test_client-authorization-delete-request.rb +0 -57
- data/test/authlete/model/request/test_client-authorization-get-list-request.rb +0 -71
- data/test/authlete/model/request/test_client-authorization-update-request.rb +0 -63
- data/test/authlete/model/request/test_client-registration-request.rb +0 -68
- data/test/authlete/model/request/test_device-authorization-request.rb +0 -75
- data/test/authlete/model/request/test_device-complete-request.rb +0 -102
- data/test/authlete/model/request/test_device-verification-request.rb +0 -57
- data/test/authlete/model/request/test_granted-scopes-request.rb +0 -57
- data/test/authlete/model/request/test_introspection-request.rb +0 -79
- data/test/authlete/model/request/test_pushed-auth-req-request.rb +0 -75
- data/test/authlete/model/request/test_revocation-request.rb +0 -67
- data/test/authlete/model/request/test_standard-introspection-request.rb +0 -57
- data/test/authlete/model/request/test_token-create-request.rb +0 -110
- data/test/authlete/model/request/test_token-fail-request.rb +0 -63
- data/test/authlete/model/request/test_token-issue-request.rb +0 -70
- data/test/authlete/model/request/test_token-request.rb +0 -94
- data/test/authlete/model/request/test_token-revoke-request.rb +0 -71
- data/test/authlete/model/request/test_token-update-request.rb +0 -82
- data/test/authlete/model/request/test_user-info-issue-request.rb +0 -67
- data/test/authlete/model/request/test_user-info-request.rb +0 -75
- data/test/authlete/model/response/test_access-token.rb +0 -101
- data/test/authlete/model/response/test_authorization-fail-response.rb +0 -68
- data/test/authlete/model/response/test_authorization-issue-response.rb +0 -92
- data/test/authlete/model/response/test_authorization-response.rb +0 -145
- data/test/authlete/model/response/test_authorized-client-list-response.rb +0 -83
- data/test/authlete/model/response/test_backchannel-authentication-complete-response.rb +0 -132
- data/test/authlete/model/response/test_backchannel-authentication-fail-response.rb +0 -68
- data/test/authlete/model/response/test_backchannel-authentication-issue-response.rb +0 -80
- data/test/authlete/model/response/test_backchannel-authentication-response.rb +0 -156
- data/test/authlete/model/response/test_client-list-response.rb +0 -79
- data/test/authlete/model/response/test_client-secret-refresh-response.rb +0 -68
- data/test/authlete/model/response/test_client-secret-update-response.rb +0 -68
- data/test/authlete/model/response/test_device-authorization-response.rb +0 -140
- data/test/authlete/model/response/test_device-complete-response.rb +0 -64
- data/test/authlete/model/response/test_device-verification-response.rb +0 -112
- data/test/authlete/model/response/test_granted-scopes-get-response.rb +0 -84
- data/test/authlete/model/response/test_introspection-response.rb +0 -127
- data/test/authlete/model/response/test_pushed-auth-req-response.rb +0 -76
- data/test/authlete/model/response/test_revocation-response.rb +0 -68
- data/test/authlete/model/response/test_service-list-response.rb +0 -72
- data/test/authlete/model/response/test_standard-introspection-response.rb +0 -68
- data/test/authlete/model/response/test_token-create-response.rb +0 -107
- data/test/authlete/model/response/test_token-fail-response.rb +0 -68
- data/test/authlete/model/response/test_token-issue-response.rb +0 -127
- data/test/authlete/model/response/test_token-list-response.rb +0 -84
- data/test/authlete/model/response/test_token-response.rb +0 -147
- data/test/authlete/model/response/test_token-revoke-response.rb +0 -63
- data/test/authlete/model/response/test_token-update-response.rb +0 -87
- data/test/authlete/model/response/test_user-info-issue-response.rb +0 -68
- data/test/authlete/model/response/test_user-info-response.rb +0 -107
- data/test/authlete/model/test_client-extension.rb +0 -98
- data/test/authlete/model/test_client.rb +0 -604
- data/test/authlete/model/test_hsk.rb +0 -108
- data/test/authlete/model/test_named-uri.rb +0 -83
- data/test/authlete/model/test_pair.rb +0 -83
- data/test/authlete/model/test_property.rb +0 -88
- data/test/authlete/model/test_result.rb +0 -68
- data/test/authlete/model/test_scope.rb +0 -104
- data/test/authlete/model/test_service-owner.rb +0 -80
- data/test/authlete/model/test_service.rb +0 -896
- data/test/authlete/model/test_sns-credentials.rb +0 -88
- data/test/authlete/model/test_tagged-value.rb +0 -83
- data/test/authlete/model/test_trust-anchor.rb +0 -84
- data/test/authlete/test_exception.rb +0 -70
- data/test/authlete/types/test_application-type.rb +0 -44
- data/test/authlete/types/test_client-auth-method.rb +0 -64
- data/test/authlete/types/test_delivery-mode.rb +0 -48
- data/test/authlete/types/test_grant-type.rb +0 -72
- data/test/authlete/types/test_jwealg.rb +0 -104
- data/test/authlete/types/test_jweenc.rb +0 -60
- data/test/authlete/types/test_jwsalg.rb +0 -96
- data/test/authlete/types/test_response-type.rb +0 -68
- data/test/authlete/types/test_subject-type.rb +0 -44
@@ -1,127 +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 TokenIssueResponseTest < Minitest::Test
|
24
|
-
RESULT_CODE = '<result-code>'
|
25
|
-
RESULT_MESSAGE = '<result-message>'
|
26
|
-
ACTION = 'OK'
|
27
|
-
RESPONSE_CONTENT = '<response-content>'
|
28
|
-
ACCESS_TOKEN = '<access-token>'
|
29
|
-
ACCESS_TOKEN_EXPIRES_AT = 1000
|
30
|
-
ACCESS_TOKEN_DURATION = 100
|
31
|
-
REFRESH_TOKEN = '<refresh-token>'
|
32
|
-
REFRESH_TOKEN_DURATION = 200
|
33
|
-
REFRESH_TOKEN_EXPIRES_AT = 1000
|
34
|
-
CLIENT_ID = 12345
|
35
|
-
CLIENT_ID_ALIAS = '<client-id-alias>'
|
36
|
-
CLIENT_ID_ALIAS_USED = true
|
37
|
-
SUBJECT = '<subject>'
|
38
|
-
SCOPES = [ 'scope0', 'scope1' ]
|
39
|
-
PROPERTY_KEY = '<property0-key>'
|
40
|
-
PROPERTY_VALUE = '<property0-value>'
|
41
|
-
PROPERTIES = [ Authlete::Model::Property.new(key: PROPERTY_KEY, value: PROPERTY_VALUE) ]
|
42
|
-
JWT_ACCESS_TOKEN = '<jwt-access-token>'
|
43
|
-
ACCESS_TOKEN_RESOURCES = [ 'access-token-resource0', 'access-token-resource1' ]
|
44
|
-
|
45
|
-
|
46
|
-
def generate_json
|
47
|
-
return <<~JSON
|
48
|
-
{
|
49
|
-
"resultCode": "<result-code>",
|
50
|
-
"resultMessage": "<result-message>",
|
51
|
-
"action": "OK",
|
52
|
-
"responseContent": "<response-content>",
|
53
|
-
"accessToken": "<access-token>",
|
54
|
-
"accessTokenExpiresAt": 1000,
|
55
|
-
"accessTokenDuration": 100,
|
56
|
-
"refreshToken": "<refresh-token>",
|
57
|
-
"refreshTokenDuration": 200,
|
58
|
-
"refreshTokenExpiresAt": 1000,
|
59
|
-
"clientId": 12345,
|
60
|
-
"clientIdAlias": "<client-id-alias>",
|
61
|
-
"clientIdAliasUsed": true,
|
62
|
-
"subject": "<subject>",
|
63
|
-
"scopes": [ "scope0", "scope1" ],
|
64
|
-
"properties": [ { "key": "<property0-key>", "value": "<property0-value>" } ],
|
65
|
-
"jwtAccessToken": "<jwt-access-token>",
|
66
|
-
"accessTokenResources": [ "access-token-resource0", "access-token-resource1" ]
|
67
|
-
}
|
68
|
-
JSON
|
69
|
-
end
|
70
|
-
|
71
|
-
|
72
|
-
def match(obj)
|
73
|
-
assert_equal RESULT_CODE, obj.resultCode
|
74
|
-
assert_equal RESULT_MESSAGE, obj.resultMessage
|
75
|
-
assert_equal ACTION, obj.action
|
76
|
-
assert_equal RESPONSE_CONTENT, obj.responseContent
|
77
|
-
assert_equal ACCESS_TOKEN, obj.accessToken
|
78
|
-
assert_equal ACCESS_TOKEN_EXPIRES_AT, obj.accessTokenExpiresAt
|
79
|
-
assert_equal ACCESS_TOKEN_DURATION, obj.accessTokenDuration
|
80
|
-
assert_equal REFRESH_TOKEN, obj.refreshToken
|
81
|
-
assert_equal REFRESH_TOKEN_EXPIRES_AT, obj.refreshTokenExpiresAt
|
82
|
-
assert_equal REFRESH_TOKEN_DURATION, obj.refreshTokenDuration
|
83
|
-
assert_equal CLIENT_ID, obj.clientId
|
84
|
-
assert_equal CLIENT_ID_ALIAS, obj.clientIdAlias
|
85
|
-
assert_equal CLIENT_ID_ALIAS_USED, obj.clientIdAliasUsed
|
86
|
-
assert_equal SUBJECT, obj.subject
|
87
|
-
assert_equal SCOPES, obj.scopes
|
88
|
-
assert_equal PROPERTY_KEY, obj.properties[0].key
|
89
|
-
assert_equal PROPERTY_VALUE, obj.properties[0].value
|
90
|
-
assert_equal JWT_ACCESS_TOKEN, obj.jwtAccessToken
|
91
|
-
assert_equal ACCESS_TOKEN_RESOURCES, obj.accessTokenResources
|
92
|
-
end
|
93
|
-
|
94
|
-
|
95
|
-
def test_from_json
|
96
|
-
jsn = generate_json
|
97
|
-
hsh = JSON.parse(jsn)
|
98
|
-
actual = Authlete::Model::Response::TokenIssueResponse.new(hsh)
|
99
|
-
|
100
|
-
match(actual)
|
101
|
-
end
|
102
|
-
|
103
|
-
|
104
|
-
def test_setters
|
105
|
-
actual = Authlete::Model::Response::TokenIssueResponse.new
|
106
|
-
actual.result_code = RESULT_CODE
|
107
|
-
actual.result_message = RESULT_MESSAGE
|
108
|
-
actual.action = ACTION
|
109
|
-
actual.response_content = RESPONSE_CONTENT
|
110
|
-
actual.access_token = ACCESS_TOKEN
|
111
|
-
actual.access_token_expires_at = ACCESS_TOKEN_EXPIRES_AT
|
112
|
-
actual.access_token_duration = ACCESS_TOKEN_DURATION
|
113
|
-
actual.refresh_token = REFRESH_TOKEN
|
114
|
-
actual.refresh_token_expires_at = REFRESH_TOKEN_EXPIRES_AT
|
115
|
-
actual.refresh_token_duration = REFRESH_TOKEN_DURATION
|
116
|
-
actual.client_id = CLIENT_ID
|
117
|
-
actual.client_id_alias = CLIENT_ID_ALIAS
|
118
|
-
actual.client_id_alias_used = CLIENT_ID_ALIAS_USED
|
119
|
-
actual.subject = SUBJECT
|
120
|
-
actual.scopes = SCOPES
|
121
|
-
actual.properties = PROPERTIES
|
122
|
-
actual.jwt_access_token = JWT_ACCESS_TOKEN
|
123
|
-
actual.access_token_resources = ACCESS_TOKEN_RESOURCES
|
124
|
-
|
125
|
-
match(actual)
|
126
|
-
end
|
127
|
-
end
|
@@ -1,84 +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 TokenListResponseTest < Minitest::Test
|
24
|
-
START_PARAM = 0
|
25
|
-
END_PARAM = 2
|
26
|
-
CLIENT_NAME = '<client-name>'
|
27
|
-
CLIENT_DEVELOPER = '<developer>'
|
28
|
-
CLIENT = Authlete::Model::Client.new(clientName: CLIENT_NAME, developer: CLIENT_DEVELOPER)
|
29
|
-
SUBJECT = '<subject>'
|
30
|
-
TOTAL_COUNT = 2
|
31
|
-
ACCESS_TOKEN0_HASH = '<access-token0-hash>'
|
32
|
-
ACCESS_TOKEN1_HASH = '<access-token1-hash>'
|
33
|
-
ACCESS_TOKENS = [ Authlete::Model::Response::AccessToken.new(accessTokenHash: ACCESS_TOKEN0_HASH),
|
34
|
-
Authlete::Model::Response::AccessToken.new(accessTokenHash: ACCESS_TOKEN1_HASH) ]
|
35
|
-
|
36
|
-
|
37
|
-
def generate_json
|
38
|
-
return <<~JSON
|
39
|
-
{
|
40
|
-
"start": 0,
|
41
|
-
"end": 2,
|
42
|
-
"client": { "clientName": "<client-name>", "developer": "<developer>" },
|
43
|
-
"subject": "<subject>",
|
44
|
-
"totalCount": 2,
|
45
|
-
"accessTokens": [ { "accessTokenHash": "<access-token0-hash>" },
|
46
|
-
{ "accessTokenHash": "<access-token1-hash>" } ]
|
47
|
-
}
|
48
|
-
JSON
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
def match(obj)
|
53
|
-
assert_equal START_PARAM, obj.start
|
54
|
-
assert_equal END_PARAM, obj.end
|
55
|
-
assert_equal CLIENT_NAME, obj.client.clientName
|
56
|
-
assert_equal CLIENT_DEVELOPER, obj.client.developer
|
57
|
-
assert_equal SUBJECT, obj.subject
|
58
|
-
assert_equal TOTAL_COUNT, obj.totalCount
|
59
|
-
assert_equal ACCESS_TOKEN0_HASH, obj.accessTokens[0].accessTokenHash
|
60
|
-
assert_equal ACCESS_TOKEN1_HASH, obj.accessTokens[1].accessTokenHash
|
61
|
-
end
|
62
|
-
|
63
|
-
|
64
|
-
def test_from_json
|
65
|
-
jsn = generate_json
|
66
|
-
hsh = JSON.parse(jsn)
|
67
|
-
actual = Authlete::Model::Response::TokenListResponse.new(hsh)
|
68
|
-
|
69
|
-
match(actual)
|
70
|
-
end
|
71
|
-
|
72
|
-
|
73
|
-
def test_setters
|
74
|
-
actual = Authlete::Model::Response::TokenListResponse.new
|
75
|
-
actual.start = START_PARAM
|
76
|
-
actual.end = END_PARAM
|
77
|
-
actual.client = CLIENT
|
78
|
-
actual.subject = SUBJECT
|
79
|
-
actual.total_count = TOTAL_COUNT
|
80
|
-
actual.access_tokens = ACCESS_TOKENS
|
81
|
-
|
82
|
-
match(actual)
|
83
|
-
end
|
84
|
-
end
|
@@ -1,147 +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 TokenResponseTest < Minitest::Test
|
24
|
-
RESULT_CODE = '<result-code>'
|
25
|
-
RESULT_MESSAGE = '<result-message>'
|
26
|
-
ACTION = 'OK'
|
27
|
-
RESPONSE_CONTENT = '<response-content>'
|
28
|
-
USERNAME = '<username>'
|
29
|
-
PASSWORD = '<password>'
|
30
|
-
TICKET = '<ticket>'
|
31
|
-
ACCESS_TOKEN = '<access-token>'
|
32
|
-
ACCESS_TOKEN_EXPIRES_AT = 1000
|
33
|
-
ACCESS_TOKEN_DURATION = 100
|
34
|
-
REFRESH_TOKEN = '<refresh-token>'
|
35
|
-
REFRESH_TOKEN_DURATION = 200
|
36
|
-
REFRESH_TOKEN_EXPIRES_AT = 1000
|
37
|
-
ID_TOKEN = '<id-token>'
|
38
|
-
GRANT_TYPE = 'AUTHORIZATION_CODE'
|
39
|
-
CLIENT_ID = 12345
|
40
|
-
CLIENT_ID_ALIAS = '<client-id-alias>'
|
41
|
-
CLIENT_ID_ALIAS_USED = true
|
42
|
-
SUBJECT = '<subject>'
|
43
|
-
SCOPES = [ 'scope0', 'scope1' ]
|
44
|
-
PROPERTY_KEY = '<property0-key>'
|
45
|
-
PROPERTY_VALUE = '<property0-value>'
|
46
|
-
PROPERTIES = [ Authlete::Model::Property.new(key: PROPERTY_KEY, value: PROPERTY_VALUE) ]
|
47
|
-
JWT_ACCESS_TOKEN = '<jwt-access-token>'
|
48
|
-
ACCESS_TOKEN_RESOURCES = [ 'access-token-resource0', 'access-token-resource1' ]
|
49
|
-
|
50
|
-
|
51
|
-
def generate_json
|
52
|
-
return <<~JSON
|
53
|
-
{
|
54
|
-
"resultCode": "<result-code>",
|
55
|
-
"resultMessage": "<result-message>",
|
56
|
-
"action": "OK",
|
57
|
-
"responseContent": "<response-content>",
|
58
|
-
"username": "<username>",
|
59
|
-
"password": "<password>",
|
60
|
-
"ticket": "<ticket>",
|
61
|
-
"accessToken": "<access-token>",
|
62
|
-
"accessTokenExpiresAt": 1000,
|
63
|
-
"accessTokenDuration": 100,
|
64
|
-
"refreshToken": "<refresh-token>",
|
65
|
-
"refreshTokenDuration": 200,
|
66
|
-
"refreshTokenExpiresAt": 1000,
|
67
|
-
"idToken": "<id-token>",
|
68
|
-
"grantType": "AUTHORIZATION_CODE",
|
69
|
-
"clientId": 12345,
|
70
|
-
"clientIdAlias": "<client-id-alias>",
|
71
|
-
"clientIdAliasUsed": true,
|
72
|
-
"subject": "<subject>",
|
73
|
-
"scopes": [ "scope0", "scope1" ],
|
74
|
-
"properties": [ { "key": "<property0-key>", "value": "<property0-value>" } ],
|
75
|
-
"jwtAccessToken": "<jwt-access-token>",
|
76
|
-
"accessTokenResources": [ "access-token-resource0", "access-token-resource1" ]
|
77
|
-
}
|
78
|
-
JSON
|
79
|
-
end
|
80
|
-
|
81
|
-
|
82
|
-
def match(obj)
|
83
|
-
assert_equal RESULT_CODE, obj.resultCode
|
84
|
-
assert_equal RESULT_MESSAGE, obj.resultMessage
|
85
|
-
assert_equal ACTION, obj.action
|
86
|
-
assert_equal RESPONSE_CONTENT, obj.responseContent
|
87
|
-
assert_equal USERNAME, obj.username
|
88
|
-
assert_equal PASSWORD, obj.password
|
89
|
-
assert_equal TICKET, obj.ticket
|
90
|
-
assert_equal ACCESS_TOKEN, obj.accessToken
|
91
|
-
assert_equal ACCESS_TOKEN_EXPIRES_AT, obj.accessTokenExpiresAt
|
92
|
-
assert_equal ACCESS_TOKEN_DURATION, obj.accessTokenDuration
|
93
|
-
assert_equal REFRESH_TOKEN, obj.refreshToken
|
94
|
-
assert_equal REFRESH_TOKEN_EXPIRES_AT, obj.refreshTokenExpiresAt
|
95
|
-
assert_equal REFRESH_TOKEN_DURATION, obj.refreshTokenDuration
|
96
|
-
assert_equal ID_TOKEN, obj.idToken
|
97
|
-
assert_equal GRANT_TYPE, obj.grantType
|
98
|
-
assert_equal CLIENT_ID, obj.clientId
|
99
|
-
assert_equal CLIENT_ID_ALIAS, obj.clientIdAlias
|
100
|
-
assert_equal CLIENT_ID_ALIAS_USED, obj.clientIdAliasUsed
|
101
|
-
assert_equal SUBJECT, obj.subject
|
102
|
-
assert_equal SCOPES, obj.scopes
|
103
|
-
assert_equal PROPERTY_KEY, obj.properties[0].key
|
104
|
-
assert_equal PROPERTY_VALUE, obj.properties[0].value
|
105
|
-
assert_equal JWT_ACCESS_TOKEN, obj.jwtAccessToken
|
106
|
-
assert_equal ACCESS_TOKEN_RESOURCES, obj.accessTokenResources
|
107
|
-
end
|
108
|
-
|
109
|
-
|
110
|
-
def test_from_json
|
111
|
-
jsn = generate_json
|
112
|
-
hsh = JSON.parse(jsn)
|
113
|
-
actual = Authlete::Model::Response::TokenResponse.new(hsh)
|
114
|
-
|
115
|
-
match(actual)
|
116
|
-
end
|
117
|
-
|
118
|
-
|
119
|
-
def test_setters
|
120
|
-
actual = Authlete::Model::Response::TokenResponse.new
|
121
|
-
actual.result_code = RESULT_CODE
|
122
|
-
actual.result_message = RESULT_MESSAGE
|
123
|
-
actual.action = ACTION
|
124
|
-
actual.response_content = RESPONSE_CONTENT
|
125
|
-
actual.username = USERNAME
|
126
|
-
actual.password = PASSWORD
|
127
|
-
actual.ticket = TICKET
|
128
|
-
actual.access_token = ACCESS_TOKEN
|
129
|
-
actual.access_token_expires_at = ACCESS_TOKEN_EXPIRES_AT
|
130
|
-
actual.access_token_duration = ACCESS_TOKEN_DURATION
|
131
|
-
actual.refresh_token = REFRESH_TOKEN
|
132
|
-
actual.refresh_token_expires_at = REFRESH_TOKEN_EXPIRES_AT
|
133
|
-
actual.refresh_token_duration = REFRESH_TOKEN_DURATION
|
134
|
-
actual.id_token = ID_TOKEN
|
135
|
-
actual.grant_type = GRANT_TYPE
|
136
|
-
actual.client_id = CLIENT_ID
|
137
|
-
actual.client_id_alias = CLIENT_ID_ALIAS
|
138
|
-
actual.client_id_alias_used = CLIENT_ID_ALIAS_USED
|
139
|
-
actual.subject = SUBJECT
|
140
|
-
actual.scopes = SCOPES
|
141
|
-
actual.properties = PROPERTIES
|
142
|
-
actual.jwt_access_token = JWT_ACCESS_TOKEN
|
143
|
-
actual.access_token_resources = ACCESS_TOKEN_RESOURCES
|
144
|
-
|
145
|
-
match(actual)
|
146
|
-
end
|
147
|
-
end
|
@@ -1,63 +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 'json'
|
20
|
-
require 'minitest/autorun'
|
21
|
-
|
22
|
-
|
23
|
-
class TokenRevokeResponseTest < Minitest::Test
|
24
|
-
RESULT_CODE = '<result-code>'
|
25
|
-
RESULT_MESSAGE = '<result-message>'
|
26
|
-
COUNT = 1
|
27
|
-
|
28
|
-
def generate_json
|
29
|
-
return <<~JSON
|
30
|
-
{
|
31
|
-
"resultCode": "<result-code>",
|
32
|
-
"resultMessage": "<result-message>",
|
33
|
-
"count": 1
|
34
|
-
}
|
35
|
-
JSON
|
36
|
-
end
|
37
|
-
|
38
|
-
|
39
|
-
def match(obj)
|
40
|
-
assert_equal RESULT_CODE, obj.resultCode
|
41
|
-
assert_equal RESULT_MESSAGE, obj.resultMessage
|
42
|
-
assert_equal COUNT, obj.count
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
def test_from_json
|
47
|
-
jsn = generate_json
|
48
|
-
hsh = JSON.parse(jsn)
|
49
|
-
actual = Authlete::Model::Response::TokenRevokeResponse.new(hsh)
|
50
|
-
|
51
|
-
match(actual)
|
52
|
-
end
|
53
|
-
|
54
|
-
|
55
|
-
def test_setters
|
56
|
-
actual = Authlete::Model::Response::TokenRevokeResponse.new
|
57
|
-
actual.result_code = RESULT_CODE
|
58
|
-
actual.result_message = RESULT_MESSAGE
|
59
|
-
actual.count = COUNT
|
60
|
-
|
61
|
-
match(actual)
|
62
|
-
end
|
63
|
-
end
|
@@ -1,87 +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 TokenUpdateResponseTest < Minitest::Test
|
24
|
-
RESULT_CODE = '<result-code>'
|
25
|
-
RESULT_MESSAGE = '<result-message>'
|
26
|
-
ACTION = 'OK'
|
27
|
-
ACCESS_TOKEN = '<access-token>'
|
28
|
-
TOKEN_TYPE = 'Bearer'
|
29
|
-
ACCESS_TOKEN_EXPIRES_AT = 1000
|
30
|
-
SCOPES = [ 'scope0', 'scope1' ]
|
31
|
-
PROPERTY_KEY = '<property0-key>'
|
32
|
-
PROPERTY_VALUE = '<property0-value>'
|
33
|
-
PROPERTIES = [ Authlete::Model::Property.new(key: PROPERTY_KEY, value: PROPERTY_VALUE) ]
|
34
|
-
|
35
|
-
|
36
|
-
def generate_json
|
37
|
-
return <<~JSON
|
38
|
-
{
|
39
|
-
"resultCode": "<result-code>",
|
40
|
-
"resultMessage": "<result-message>",
|
41
|
-
"action": "OK",
|
42
|
-
"accessToken": "<access-token>",
|
43
|
-
"tokenType": "Bearer",
|
44
|
-
"accessTokenExpiresAt": 1000,
|
45
|
-
"scopes": [ "scope0", "scope1" ],
|
46
|
-
"properties": [ { "key": "<property0-key>", "value": "<property0-value>" } ]
|
47
|
-
}
|
48
|
-
JSON
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
def match(obj)
|
53
|
-
assert_equal RESULT_CODE, obj.resultCode
|
54
|
-
assert_equal RESULT_MESSAGE, obj.resultMessage
|
55
|
-
assert_equal ACTION, obj.action
|
56
|
-
assert_equal ACCESS_TOKEN, obj.accessToken
|
57
|
-
assert_equal TOKEN_TYPE, obj.tokenType
|
58
|
-
assert_equal ACCESS_TOKEN_EXPIRES_AT, obj.accessTokenExpiresAt
|
59
|
-
assert_equal SCOPES, obj.scopes
|
60
|
-
assert_equal PROPERTY_KEY, obj.properties[0].key
|
61
|
-
assert_equal PROPERTY_VALUE, obj.properties[0].value
|
62
|
-
end
|
63
|
-
|
64
|
-
|
65
|
-
def test_from_json
|
66
|
-
jsn = generate_json
|
67
|
-
hsh = JSON.parse(jsn)
|
68
|
-
actual = Authlete::Model::Response::TokenUpdateResponse.new(hsh)
|
69
|
-
|
70
|
-
match(actual)
|
71
|
-
end
|
72
|
-
|
73
|
-
|
74
|
-
def test_setters
|
75
|
-
actual = Authlete::Model::Response::TokenUpdateResponse.new
|
76
|
-
actual.result_code = RESULT_CODE
|
77
|
-
actual.result_message = RESULT_MESSAGE
|
78
|
-
actual.action = ACTION
|
79
|
-
actual.access_token = ACCESS_TOKEN
|
80
|
-
actual.token_type = TOKEN_TYPE
|
81
|
-
actual.access_token_expires_at = ACCESS_TOKEN_EXPIRES_AT
|
82
|
-
actual.scopes = SCOPES
|
83
|
-
actual.properties = PROPERTIES
|
84
|
-
|
85
|
-
match(actual)
|
86
|
-
end
|
87
|
-
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 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
|