authlete 1.38.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,92 +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 AuthorizationIssueResponseTest < Minitest::Test
|
24
|
-
RESULT_CODE = '<result-code>'
|
25
|
-
RESULT_MESSAGE = '<result-message>'
|
26
|
-
ACTION = 'LOCATION'
|
27
|
-
RESPONSE_CONTENT = '<response-content>'
|
28
|
-
ACCESS_TOKEN = '<access-token>'
|
29
|
-
ACCESS_TOKEN_EXPIRES_AT = 1000
|
30
|
-
ACCESS_TOKEN_DURATION = 300
|
31
|
-
ID_TOKEN = '<id-token>'
|
32
|
-
AUTHORIZATION_CODE = '<authorization-code>'
|
33
|
-
JWT_ACCESS_TOKEN = '<jwt-access-token>'
|
34
|
-
|
35
|
-
|
36
|
-
def generate_json
|
37
|
-
return <<~JSON
|
38
|
-
{
|
39
|
-
"resultCode": "<result-code>",
|
40
|
-
"resultMessage": "<result-message>",
|
41
|
-
"action": "LOCATION",
|
42
|
-
"responseContent": "<response-content>",
|
43
|
-
"accessToken": "<access-token>",
|
44
|
-
"accessTokenExpiresAt": 1000,
|
45
|
-
"accessTokenDuration": 300,
|
46
|
-
"idToken": "<id-token>",
|
47
|
-
"authorizationCode": "<authorization-code>",
|
48
|
-
"jwtAccessToken": "<jwt-access-token>"
|
49
|
-
}
|
50
|
-
JSON
|
51
|
-
end
|
52
|
-
|
53
|
-
|
54
|
-
def match(obj)
|
55
|
-
assert_equal RESULT_CODE, obj.resultCode
|
56
|
-
assert_equal RESULT_MESSAGE, obj.resultMessage
|
57
|
-
assert_equal ACTION, obj.action
|
58
|
-
assert_equal RESPONSE_CONTENT, obj.responseContent
|
59
|
-
assert_equal ACCESS_TOKEN, obj.accessToken
|
60
|
-
assert_equal ACCESS_TOKEN_EXPIRES_AT, obj.accessTokenExpiresAt
|
61
|
-
assert_equal ACCESS_TOKEN_DURATION, obj.accessTokenDuration
|
62
|
-
assert_equal ID_TOKEN, obj.idToken
|
63
|
-
assert_equal AUTHORIZATION_CODE, obj.authorizationCode
|
64
|
-
assert_equal JWT_ACCESS_TOKEN, obj.jwtAccessToken
|
65
|
-
end
|
66
|
-
|
67
|
-
|
68
|
-
def test_from_json
|
69
|
-
jsn = generate_json
|
70
|
-
hsh = JSON.parse(jsn)
|
71
|
-
actual = Authlete::Model::Response::AuthorizationIssueResponse.new(hsh)
|
72
|
-
|
73
|
-
match(actual)
|
74
|
-
end
|
75
|
-
|
76
|
-
|
77
|
-
def test_setters
|
78
|
-
actual = Authlete::Model::Response::AuthorizationIssueResponse.new
|
79
|
-
actual.result_code = RESULT_CODE
|
80
|
-
actual.result_message = RESULT_MESSAGE
|
81
|
-
actual.action = ACTION
|
82
|
-
actual.response_content = RESPONSE_CONTENT
|
83
|
-
actual.access_token = ACCESS_TOKEN
|
84
|
-
actual.access_token_expires_at = ACCESS_TOKEN_EXPIRES_AT
|
85
|
-
actual.access_token_duration = ACCESS_TOKEN_DURATION
|
86
|
-
actual.id_token = ID_TOKEN
|
87
|
-
actual.authorization_code = AUTHORIZATION_CODE
|
88
|
-
actual.jwt_access_token = JWT_ACCESS_TOKEN
|
89
|
-
|
90
|
-
match(actual)
|
91
|
-
end
|
92
|
-
end
|
@@ -1,145 +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 AuthorizationResponseTest < Minitest::Test
|
24
|
-
RESULT_CODE = '<result-code>'
|
25
|
-
RESULT_MESSAGE = '<result-message>'
|
26
|
-
ACRS = [ 'acr0', 'acr1' ]
|
27
|
-
ACTION = 'FORM'
|
28
|
-
CLAIMS_LOCALES = [ 'en', 'ja' ]
|
29
|
-
CLAIMS = [ 'claim0', 'claim1' ]
|
30
|
-
DISPLAY = 'PAGE'
|
31
|
-
ID_TOKEN_CLAIMS = '<id-token-claims>'
|
32
|
-
LOGIN_HINT = '<login-hint>'
|
33
|
-
MAX_AGE = 100
|
34
|
-
PROMPTS = [ 'CONSENT', 'LOGIN' ]
|
35
|
-
PURPOSE = '<purpose>'
|
36
|
-
REQUEST_OBJECT_PAYLOAD = '<request-object-payload>'
|
37
|
-
RESOURCES = [ 'resource0', 'resource1' ]
|
38
|
-
RESPONSE_CONTENT = '<response-content>'
|
39
|
-
SERVICE_NAME = '<service-name>'
|
40
|
-
SERVICE = Authlete::Model::Service.new({serviceName: SERVICE_NAME})
|
41
|
-
SCOPE_NAME = 'scope0'
|
42
|
-
SCOPE_DESCRIPTION = '<scope0-description>'
|
43
|
-
SCOPES = [ Authlete::Model::Scope.new({ name: SCOPE_NAME, description: SCOPE_DESCRIPTION }) ]
|
44
|
-
SUBJECT = '<subject>'
|
45
|
-
TICKET = '<ticket>'
|
46
|
-
UI_LOCALES = [ 'de', 'fr' ]
|
47
|
-
USER_INFO_CLAIMS = '<user-info-claims>'
|
48
|
-
|
49
|
-
|
50
|
-
def generate_json
|
51
|
-
return <<~JSON
|
52
|
-
{
|
53
|
-
"resultCode": "<result-code>",
|
54
|
-
"resultMessage": "<result-message>",
|
55
|
-
"acrs": [ "acr0", "acr1" ],
|
56
|
-
"action": "FORM",
|
57
|
-
"claimsLocales": [ "en", "ja" ],
|
58
|
-
"claims": [ "claim0", "claim1" ],
|
59
|
-
"display": "PAGE",
|
60
|
-
"idTokenClaims": "<id-token-claims>",
|
61
|
-
"loginHint": "<login-hint>",
|
62
|
-
"maxAge": 100,
|
63
|
-
"prompts": [ "CONSENT", "LOGIN" ],
|
64
|
-
"purpose": "<purpose>",
|
65
|
-
"requestObjectPayload": "<request-object-payload>",
|
66
|
-
"resources": [ "resource0", "resource1" ],
|
67
|
-
"responseContent": "<response-content>",
|
68
|
-
"service": {
|
69
|
-
"serviceName": "<service-name>"
|
70
|
-
},
|
71
|
-
"scopes": [
|
72
|
-
{
|
73
|
-
"name": "scope0",
|
74
|
-
"description": "<scope0-description>"
|
75
|
-
}
|
76
|
-
],
|
77
|
-
"subject": "<subject>",
|
78
|
-
"ticket": "<ticket>",
|
79
|
-
"uiLocales": [ "de", "fr" ],
|
80
|
-
"userInfoClaims": "<user-info-claims>"
|
81
|
-
}
|
82
|
-
JSON
|
83
|
-
end
|
84
|
-
|
85
|
-
|
86
|
-
def match(obj)
|
87
|
-
assert_equal RESULT_CODE, obj.resultCode
|
88
|
-
assert_equal RESULT_MESSAGE, obj.resultMessage
|
89
|
-
assert_equal ACTION, obj.action
|
90
|
-
assert_equal ACRS, obj.acrs
|
91
|
-
assert_equal CLAIMS_LOCALES, obj.claimsLocales
|
92
|
-
assert_equal CLAIMS, obj.claims
|
93
|
-
assert_equal DISPLAY, obj.display
|
94
|
-
assert_equal ID_TOKEN_CLAIMS, obj.idTokenClaims
|
95
|
-
assert_equal MAX_AGE, obj.maxAge
|
96
|
-
assert_equal PROMPTS, obj.prompts
|
97
|
-
assert_equal PURPOSE, obj.purpose
|
98
|
-
assert_equal REQUEST_OBJECT_PAYLOAD, obj.requestObjectPayload
|
99
|
-
assert_equal RESOURCES, obj.resources
|
100
|
-
assert_equal RESPONSE_CONTENT, obj.responseContent
|
101
|
-
assert_equal SERVICE_NAME, obj.service.serviceName
|
102
|
-
assert_equal SCOPE_NAME, obj.scopes[0].name
|
103
|
-
assert_equal SCOPE_DESCRIPTION, obj.scopes[0].description
|
104
|
-
assert_equal SUBJECT, obj.subject
|
105
|
-
assert_equal TICKET, obj.ticket
|
106
|
-
assert_equal UI_LOCALES, obj.uiLocales
|
107
|
-
assert_equal USER_INFO_CLAIMS, obj.userInfoClaims
|
108
|
-
end
|
109
|
-
|
110
|
-
|
111
|
-
def test_from_json
|
112
|
-
jsn = generate_json
|
113
|
-
hsh = JSON.parse(jsn)
|
114
|
-
actual = Authlete::Model::Response::AuthorizationResponse.new(hsh)
|
115
|
-
|
116
|
-
match(actual)
|
117
|
-
end
|
118
|
-
|
119
|
-
|
120
|
-
def test_setters
|
121
|
-
actual = Authlete::Model::Response::AuthorizationResponse.new
|
122
|
-
actual.result_code = RESULT_CODE
|
123
|
-
actual.result_message = RESULT_MESSAGE
|
124
|
-
actual.acrs = ACRS
|
125
|
-
actual.action = ACTION
|
126
|
-
actual.claims_locales = CLAIMS_LOCALES
|
127
|
-
actual.claims = CLAIMS
|
128
|
-
actual.display = DISPLAY
|
129
|
-
actual.id_token_claims = ID_TOKEN_CLAIMS
|
130
|
-
actual.max_age = MAX_AGE
|
131
|
-
actual.prompts = PROMPTS
|
132
|
-
actual.purpose = PURPOSE
|
133
|
-
actual.request_object_payload = REQUEST_OBJECT_PAYLOAD
|
134
|
-
actual.resources = RESOURCES
|
135
|
-
actual.response_content = RESPONSE_CONTENT
|
136
|
-
actual.service = SERVICE
|
137
|
-
actual.scopes = SCOPES
|
138
|
-
actual.subject = SUBJECT
|
139
|
-
actual.ticket = TICKET
|
140
|
-
actual.ui_locales = UI_LOCALES
|
141
|
-
actual.user_info_claims = USER_INFO_CLAIMS
|
142
|
-
|
143
|
-
match(actual)
|
144
|
-
end
|
145
|
-
end
|
@@ -1,83 +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 AuthorizedClientListResponseTest < Minitest::Test
|
24
|
-
START_PARAM = 0
|
25
|
-
END_PARAM = 2
|
26
|
-
DEVELOPER = '<developer>'
|
27
|
-
TOTAL_COUNT = 2
|
28
|
-
CLIENT0_NAME = 'client0'
|
29
|
-
CLIENT1_NAME = 'client1'
|
30
|
-
CLIENTS = [ Authlete::Model::Client.new(clientName: CLIENT0_NAME, developer: DEVELOPER),
|
31
|
-
Authlete::Model::Client.new(clientName: CLIENT1_NAME, developer: DEVELOPER) ]
|
32
|
-
SUBJECT = '<subject>'
|
33
|
-
|
34
|
-
|
35
|
-
def generate_json
|
36
|
-
return <<~JSON
|
37
|
-
{
|
38
|
-
"start": 0,
|
39
|
-
"end": 2,
|
40
|
-
"developer": "<developer>",
|
41
|
-
"totalCount": 2,
|
42
|
-
"clients": [ { "clientName": "client0", "developer": "<developer>" },
|
43
|
-
{ "clientName": "client1", "developer": "<developer>" } ],
|
44
|
-
"subject": "<subject>"
|
45
|
-
}
|
46
|
-
JSON
|
47
|
-
end
|
48
|
-
|
49
|
-
|
50
|
-
def match(obj)
|
51
|
-
assert_equal START_PARAM, obj.start
|
52
|
-
assert_equal END_PARAM, obj.end
|
53
|
-
assert_equal DEVELOPER, obj.developer
|
54
|
-
assert_equal TOTAL_COUNT, obj.totalCount
|
55
|
-
assert_equal CLIENT0_NAME, obj.clients[0].clientName
|
56
|
-
assert_equal DEVELOPER, obj.clients[0].developer
|
57
|
-
assert_equal CLIENT1_NAME, obj.clients[1].clientName
|
58
|
-
assert_equal DEVELOPER, obj.clients[1].developer
|
59
|
-
assert_equal SUBJECT, obj.subject
|
60
|
-
end
|
61
|
-
|
62
|
-
|
63
|
-
def test_from_json
|
64
|
-
jsn = generate_json
|
65
|
-
hsh = JSON.parse(jsn)
|
66
|
-
actual = Authlete::Model::Response::AuthorizedClientListResponse.new(hsh)
|
67
|
-
|
68
|
-
match(actual)
|
69
|
-
end
|
70
|
-
|
71
|
-
|
72
|
-
def test_setters
|
73
|
-
actual = Authlete::Model::Response::AuthorizedClientListResponse.new
|
74
|
-
actual.start = START_PARAM
|
75
|
-
actual.end = END_PARAM
|
76
|
-
actual.developer = DEVELOPER
|
77
|
-
actual.total_count = TOTAL_COUNT
|
78
|
-
actual.clients = CLIENTS
|
79
|
-
actual.subject = SUBJECT
|
80
|
-
|
81
|
-
match(actual)
|
82
|
-
end
|
83
|
-
end
|
@@ -1,132 +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 BackchannelAuthenticationCompleteResponseTest < Minitest::Test
|
24
|
-
RESULT_CODE = '<result-code>'
|
25
|
-
RESULT_MESSAGE = '<result-message>'
|
26
|
-
ACTION = 'NOTIFICATION'
|
27
|
-
RESPONSE_CONTENT = '<response-content>'
|
28
|
-
CLIENT_ID = 12345
|
29
|
-
CLIENT_ID_ALIAS = '<client-id-alias>'
|
30
|
-
CLIENT_ID_ALIAS_USED = false
|
31
|
-
CLIENT_NAME = '<client-name>'
|
32
|
-
DELIVERY_METHOD = 'POLL'
|
33
|
-
CLIENT_NOTIFICATION_ENDPOINT = '<client-notification-endpoint>'
|
34
|
-
CLIENT_NOTIFICATION_TOKEN = '<client-notification-token>'
|
35
|
-
AUTH_REQ_ID = '<auth-req-id>'
|
36
|
-
ACCESS_TOKEN = '<access-token>'
|
37
|
-
REFRESH_TOKEN = '<refresh-token>'
|
38
|
-
ID_TOKEN = '<id-token>'
|
39
|
-
ACCESS_TOKEN_DURATION = 100
|
40
|
-
REFRESH_TOKEN_DURATION = 200
|
41
|
-
ID_TOKEN_DURATION = 300
|
42
|
-
JWT_ACCESS_TOKEN = '<jwt-access-token>'
|
43
|
-
RESOURCES = [ 'resource0', 'resource1' ]
|
44
|
-
|
45
|
-
|
46
|
-
def generate_json
|
47
|
-
return <<~JSON
|
48
|
-
{
|
49
|
-
"resultCode": "<result-code>",
|
50
|
-
"resultMessage": "<result-message>",
|
51
|
-
"action": "NOTIFICATION",
|
52
|
-
"responseContent": "<response-content>",
|
53
|
-
"clientId": 12345,
|
54
|
-
"clientIdAlias": "<client-id-alias>",
|
55
|
-
"clientIdAliasUsed": false,
|
56
|
-
"clientName": "<client-name>",
|
57
|
-
"deliveryMethod": "POLL",
|
58
|
-
"clientNotificationEndpoint": "<client-notification-endpoint>",
|
59
|
-
"clientNotificationToken": "<client-notification-token>",
|
60
|
-
"authReqId": "<auth-req-id>",
|
61
|
-
"accessToken": "<access-token>",
|
62
|
-
"refreshToken": "<refresh-token>",
|
63
|
-
"idToken": "<id-token>",
|
64
|
-
"accessTokenDuration": 100,
|
65
|
-
"refreshTokenDuration": 200,
|
66
|
-
"idTokenDuration": 300,
|
67
|
-
"jwtAccessToken": "<jwt-access-token>",
|
68
|
-
"resources": [ "resource0", "resource1" ]
|
69
|
-
}
|
70
|
-
JSON
|
71
|
-
end
|
72
|
-
|
73
|
-
|
74
|
-
def match(obj)
|
75
|
-
assert_equal RESULT_CODE, obj.resultCode
|
76
|
-
assert_equal RESULT_MESSAGE, obj.resultMessage
|
77
|
-
assert_equal ACTION, obj.action
|
78
|
-
assert_equal RESPONSE_CONTENT, obj.responseContent
|
79
|
-
assert_equal CLIENT_ID, obj.clientId
|
80
|
-
assert_equal CLIENT_ID_ALIAS, obj.clientIdAlias
|
81
|
-
assert_equal CLIENT_ID_ALIAS_USED, obj.clientIdAliasUsed
|
82
|
-
assert_equal CLIENT_NAME, obj.clientName
|
83
|
-
assert_equal DELIVERY_METHOD, obj.deliveryMethod
|
84
|
-
assert_equal CLIENT_NOTIFICATION_ENDPOINT, obj.clientNotificationEndpoint
|
85
|
-
assert_equal CLIENT_NOTIFICATION_TOKEN, obj.clientNotificationToken
|
86
|
-
assert_equal AUTH_REQ_ID, obj.authReqId
|
87
|
-
assert_equal ACCESS_TOKEN, obj.accessToken
|
88
|
-
assert_equal REFRESH_TOKEN, obj.refreshToken
|
89
|
-
assert_equal ID_TOKEN, obj.idToken
|
90
|
-
assert_equal ACCESS_TOKEN_DURATION, obj.accessTokenDuration
|
91
|
-
assert_equal REFRESH_TOKEN_DURATION, obj.refreshTokenDuration
|
92
|
-
assert_equal ID_TOKEN_DURATION, obj.idTokenDuration
|
93
|
-
assert_equal JWT_ACCESS_TOKEN, obj.jwtAccessToken
|
94
|
-
assert_equal RESOURCES, obj.resources
|
95
|
-
end
|
96
|
-
|
97
|
-
|
98
|
-
def test_from_json
|
99
|
-
jsn = generate_json
|
100
|
-
hsh = JSON.parse(jsn)
|
101
|
-
actual = Authlete::Model::Response::BackchannelAuthenticationCompleteResponse.new(hsh)
|
102
|
-
|
103
|
-
match(actual)
|
104
|
-
end
|
105
|
-
|
106
|
-
|
107
|
-
def test_setters
|
108
|
-
actual = Authlete::Model::Response::BackchannelAuthenticationCompleteResponse.new
|
109
|
-
actual.result_code = RESULT_CODE
|
110
|
-
actual.result_message = RESULT_MESSAGE
|
111
|
-
actual.action = ACTION
|
112
|
-
actual.response_content = RESPONSE_CONTENT
|
113
|
-
actual.client_id = CLIENT_ID
|
114
|
-
actual.client_id_alias = CLIENT_ID_ALIAS
|
115
|
-
actual.client_id_alias_used = CLIENT_ID_ALIAS_USED
|
116
|
-
actual.client_name = CLIENT_NAME
|
117
|
-
actual.delivery_method = DELIVERY_METHOD
|
118
|
-
actual.client_notification_endpoint = CLIENT_NOTIFICATION_ENDPOINT
|
119
|
-
actual.client_notification_token = CLIENT_NOTIFICATION_TOKEN
|
120
|
-
actual.auth_req_id = AUTH_REQ_ID
|
121
|
-
actual.access_token = ACCESS_TOKEN
|
122
|
-
actual.refresh_token = REFRESH_TOKEN
|
123
|
-
actual.id_token = ID_TOKEN
|
124
|
-
actual.access_token_duration = ACCESS_TOKEN_DURATION
|
125
|
-
actual.refresh_token_duration = REFRESH_TOKEN_DURATION
|
126
|
-
actual.id_token_duration = ID_TOKEN_DURATION
|
127
|
-
actual.jwt_access_token = JWT_ACCESS_TOKEN
|
128
|
-
actual.resources = RESOURCES
|
129
|
-
|
130
|
-
match(actual)
|
131
|
-
end
|
132
|
-
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 BackchannelAuthenticationFailResponseTest < Minitest::Test
|
24
|
-
RESULT_CODE = '<result-code>'
|
25
|
-
RESULT_MESSAGE = '<result-message>'
|
26
|
-
ACTION = 'BAD_REQUEST'
|
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": "BAD_REQUEST",
|
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::BackchannelAuthenticationFailResponse.new(hsh)
|
54
|
-
|
55
|
-
match(actual)
|
56
|
-
end
|
57
|
-
|
58
|
-
|
59
|
-
def test_setters
|
60
|
-
actual = Authlete::Model::Response::BackchannelAuthenticationFailResponse.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,80 +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 BackchannelAuthenticationIssueResponseTest < Minitest::Test
|
24
|
-
RESULT_CODE = '<result-code>'
|
25
|
-
RESULT_MESSAGE = '<result-message>'
|
26
|
-
ACTION = 'OK'
|
27
|
-
RESPONSE_CONTENT = '<response-content>'
|
28
|
-
AUTH_REQ_ID = '<auth-req-id>'
|
29
|
-
EXPIRES_IN = 1000
|
30
|
-
INTERVAL = 100
|
31
|
-
|
32
|
-
|
33
|
-
def generate_json
|
34
|
-
return <<~JSON
|
35
|
-
{
|
36
|
-
"resultCode": "<result-code>",
|
37
|
-
"resultMessage": "<result-message>",
|
38
|
-
"action": "OK",
|
39
|
-
"responseContent": "<response-content>",
|
40
|
-
"authReqId": "<auth-req-id>",
|
41
|
-
"expiresIn": 1000,
|
42
|
-
"interval": 100
|
43
|
-
}
|
44
|
-
JSON
|
45
|
-
end
|
46
|
-
|
47
|
-
|
48
|
-
def match(obj)
|
49
|
-
assert_equal RESULT_CODE, obj.resultCode
|
50
|
-
assert_equal RESULT_MESSAGE, obj.resultMessage
|
51
|
-
assert_equal ACTION, obj.action
|
52
|
-
assert_equal RESPONSE_CONTENT, obj.responseContent
|
53
|
-
assert_equal AUTH_REQ_ID, obj.authReqId
|
54
|
-
assert_equal EXPIRES_IN, obj.expiresIn
|
55
|
-
assert_equal INTERVAL, obj.interval
|
56
|
-
end
|
57
|
-
|
58
|
-
|
59
|
-
def test_from_json
|
60
|
-
jsn = generate_json
|
61
|
-
hsh = JSON.parse(jsn)
|
62
|
-
actual = Authlete::Model::Response::BackchannelAuthenticationIssueResponse.new(hsh)
|
63
|
-
|
64
|
-
match(actual)
|
65
|
-
end
|
66
|
-
|
67
|
-
|
68
|
-
def test_setters
|
69
|
-
actual = Authlete::Model::Response::BackchannelAuthenticationIssueResponse.new
|
70
|
-
actual.result_code = RESULT_CODE
|
71
|
-
actual.result_message = RESULT_MESSAGE
|
72
|
-
actual.action = ACTION
|
73
|
-
actual.response_content = RESPONSE_CONTENT
|
74
|
-
actual.auth_req_id = AUTH_REQ_ID
|
75
|
-
actual.expires_in = EXPIRES_IN
|
76
|
-
actual.interval = INTERVAL
|
77
|
-
|
78
|
-
match(actual)
|
79
|
-
end
|
80
|
-
end
|