authlete 1.0.20 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -1
- data/Makefile +40 -0
- data/README.md +20 -20
- data/Rakefile +5 -0
- data/authlete.gemspec +2 -2
- data/lib/authlete.rb +28 -9
- data/lib/authlete/api.rb +153 -322
- data/lib/authlete/authentication-server.rb +230 -230
- data/lib/authlete/exception.rb +14 -15
- data/lib/authlete/model/base.rb +30 -0
- data/lib/authlete/model/client-extension.rb +17 -119
- data/lib/authlete/model/client.rb +203 -338
- data/lib/authlete/model/hashable.rb +13 -33
- data/lib/authlete/model/named-uri.rb +13 -74
- data/lib/authlete/model/pair.rb +13 -74
- data/lib/authlete/model/param-initializer.rb +45 -0
- data/lib/authlete/model/property.rb +15 -85
- data/lib/authlete/model/request/authentication-callback-request.rb +63 -55
- data/lib/authlete/model/request/authorization-fail-request.rb +14 -75
- data/lib/authlete/model/request/authorization-issue-request.rb +38 -119
- data/lib/authlete/model/request/authorization-request.rb +8 -73
- data/lib/authlete/model/request/backchannel-authentication-complete-request.rb +97 -0
- data/lib/authlete/model/request/backchannel-authentication-fail-request.rb +55 -0
- data/lib/authlete/model/request/backchannel-authentication-issue-request.rb +37 -0
- data/lib/authlete/model/request/backchannel-authentication-request.rb +63 -0
- data/lib/authlete/model/request/base.rb +26 -0
- data/lib/authlete/model/request/client-authorization-delete-request.rb +7 -93
- data/lib/authlete/model/request/client-authorization-get-list-request.rb +17 -89
- data/lib/authlete/model/request/client-authorization-update-request.rb +11 -86
- data/lib/authlete/model/request/client-registration-request.rb +49 -0
- data/lib/authlete/model/request/client-secret-update-request.rb +7 -89
- data/lib/authlete/model/request/developer-authentication-callback-request.rb +40 -43
- data/lib/authlete/model/request/device-authorization-request.rb +63 -0
- data/lib/authlete/model/request/device-complete-request.rb +99 -0
- data/lib/authlete/model/request/device-verification-request.rb +40 -0
- data/lib/authlete/model/request/granted-scopes-request.rb +8 -74
- data/lib/authlete/model/request/introspection-request.rb +24 -83
- data/lib/authlete/model/request/pushed-auth-req-request.rb +64 -0
- data/lib/authlete/model/request/revocation-request.rb +14 -88
- data/lib/authlete/model/request/standard-introspection-request.rb +8 -73
- data/lib/authlete/model/request/token-create-request.rb +52 -183
- data/lib/authlete/model/request/token-fail-request.rb +12 -74
- data/lib/authlete/model/request/token-issue-request.rb +22 -80
- data/lib/authlete/model/request/token-request.rb +44 -81
- data/lib/authlete/model/request/token-update-request.rb +35 -121
- data/lib/authlete/model/request/user-info-issue-request.rb +14 -80
- data/lib/authlete/model/request/user-info-request.rb +25 -70
- data/lib/authlete/model/response/access-token.rb +96 -0
- data/lib/authlete/model/response/authentication-callback-response.rb +24 -19
- data/lib/authlete/model/response/authorization-fail-response.rb +13 -15
- data/lib/authlete/model/response/authorization-issue-response.rb +29 -32
- data/lib/authlete/model/response/authorization-response.rb +97 -123
- data/lib/authlete/model/response/authorized-client-list-response.rb +37 -0
- data/lib/authlete/model/response/backchannel-authentication-complete-response.rb +143 -0
- data/lib/authlete/model/response/backchannel-authentication-fail-response.rb +47 -0
- data/lib/authlete/model/response/backchannel-authentication-issue-response.rb +63 -0
- data/lib/authlete/model/response/backchannel-authentication-response.rb +160 -0
- data/lib/authlete/model/response/client-list-response.rb +58 -0
- data/lib/authlete/model/response/client-registration-response.rb +50 -0
- data/lib/authlete/model/response/client-secret-refresh-response.rb +12 -12
- data/lib/authlete/model/response/client-secret-update-response.rb +12 -12
- data/lib/authlete/model/response/developer-authentication-callback-response.rb +24 -19
- data/lib/authlete/model/response/device-authorization-response.rb +134 -0
- data/lib/authlete/model/response/device-complete-response.rb +39 -0
- data/lib/authlete/model/response/device-verification-response.rb +96 -0
- data/lib/authlete/model/response/granted-scopes-get-response.rb +27 -19
- data/lib/authlete/model/response/introspection-response.rb +64 -58
- data/lib/authlete/model/response/pushed-auth-req-response.rb +59 -0
- data/lib/authlete/model/response/revocation-response.rb +12 -15
- data/lib/authlete/model/response/service-list-response.rb +54 -0
- data/lib/authlete/model/response/standard-introspection-response.rb +13 -15
- data/lib/authlete/model/response/token-create-response.rb +50 -55
- data/lib/authlete/model/response/token-fail-response.rb +14 -17
- data/lib/authlete/model/response/token-issue-response.rb +49 -62
- data/lib/authlete/model/response/token-list-response.rb +64 -0
- data/lib/authlete/model/response/token-response.rb +59 -79
- data/lib/authlete/model/response/token-update-response.rb +28 -23
- data/lib/authlete/model/response/user-info-issue-response.rb +16 -16
- data/lib/authlete/model/response/user-info-response.rb +48 -42
- data/lib/authlete/model/result.rb +14 -13
- data/lib/authlete/model/scope.rb +68 -158
- data/lib/authlete/model/service-owner.rb +32 -116
- data/lib/authlete/model/service.rb +660 -830
- data/lib/authlete/model/sns-credentials.rb +51 -124
- data/lib/authlete/model/tagged-value.rb +14 -69
- data/lib/authlete/utility.rb +70 -99
- data/lib/authlete/version.rb +3 -3
- data/test/authlete/model/request/test_authentication-callback-request.rb +100 -0
- data/test/authlete/model/request/test_authorization-fail-request.rb +67 -0
- data/test/authlete/model/request/test_authorization-issue-request.rb +94 -0
- data/test/authlete/model/request/test_authorization-request.rb +57 -0
- data/test/authlete/model/request/test_backchannel-authentication-complete-request.rb +102 -0
- data/test/authlete/model/request/test_backchannel-authentication-fail-request.rb +71 -0
- data/test/authlete/model/request/test_backchannel-authentication-issue-request.rb +57 -0
- data/test/authlete/model/request/test_backchannel-authentication-request.rb +75 -0
- data/test/authlete/model/request/test_client-authorization-delete-request.rb +57 -0
- data/test/authlete/model/request/test_client-authorization-get-list-request.rb +71 -0
- data/test/authlete/model/request/test_client-authorization-update-request.rb +63 -0
- data/test/authlete/model/request/test_client-registration-request.rb +68 -0
- data/test/authlete/model/request/test_device-authorization-request.rb +75 -0
- data/test/authlete/model/request/test_device-complete-request.rb +102 -0
- data/test/authlete/model/request/test_device-verification-request.rb +57 -0
- data/test/authlete/model/request/test_granted-scopes-request.rb +57 -0
- data/test/authlete/model/request/test_introspection-request.rb +79 -0
- data/test/authlete/model/request/test_pushed-auth-req-request.rb +75 -0
- data/test/authlete/model/request/test_revocation-request.rb +67 -0
- data/test/authlete/model/request/test_standard-introspection-request.rb +57 -0
- data/test/authlete/model/request/test_token-create-request.rb +110 -0
- data/test/authlete/model/request/test_token-fail-request.rb +63 -0
- data/test/authlete/model/request/test_token-issue-request.rb +70 -0
- data/test/authlete/model/request/test_token-request.rb +94 -0
- data/test/authlete/model/request/test_token-update-request.rb +82 -0
- data/test/authlete/model/request/test_user-info-issue-request.rb +67 -0
- data/test/authlete/model/request/test_user-info-request.rb +75 -0
- data/test/authlete/model/response/test_access-token.rb +101 -0
- data/test/authlete/model/response/test_authorization-fail-response.rb +68 -0
- data/test/authlete/model/response/test_authorization-issue-response.rb +92 -0
- data/test/authlete/model/response/test_authorization-response.rb +145 -0
- data/test/authlete/model/response/test_authorized-client-list-response.rb +83 -0
- data/test/authlete/model/response/test_backchannel-authentication-complete-response.rb +132 -0
- data/test/authlete/model/response/test_backchannel-authentication-fail-response.rb +68 -0
- data/test/authlete/model/response/test_backchannel-authentication-issue-response.rb +80 -0
- data/test/authlete/model/response/test_backchannel-authentication-response.rb +156 -0
- data/test/authlete/model/response/test_client-list-response.rb +79 -0
- data/test/authlete/model/response/test_client-secret-refresh-response.rb +68 -0
- data/test/authlete/model/response/test_client-secret-update-response.rb +68 -0
- data/test/authlete/model/response/test_device-authorization-response.rb +140 -0
- data/test/authlete/model/response/test_device-complete-response.rb +64 -0
- data/test/authlete/model/response/test_device-verification-response.rb +112 -0
- data/test/authlete/model/response/test_granted-scopes-get-response.rb +84 -0
- data/test/authlete/model/response/test_introspection-response.rb +127 -0
- data/test/authlete/model/response/test_pushed-auth-req-response.rb +76 -0
- data/test/authlete/model/response/test_revocation-response.rb +68 -0
- data/test/authlete/model/response/test_service-list-response.rb +72 -0
- data/test/authlete/model/response/test_standard-introspection-response.rb +68 -0
- data/test/authlete/model/response/test_token-create-response.rb +107 -0
- data/test/authlete/model/response/test_token-fail-response.rb +68 -0
- data/test/authlete/model/response/test_token-issue-response.rb +127 -0
- data/test/authlete/model/response/test_token-list-response.rb +84 -0
- data/test/authlete/model/response/test_token-response.rb +147 -0
- data/test/authlete/model/response/test_token-update-response.rb +87 -0
- data/test/authlete/model/response/test_user-info-issue-response.rb +68 -0
- data/test/authlete/model/response/test_user-info-response.rb +107 -0
- data/test/authlete/model/test_client-extension.rb +95 -0
- data/test/authlete/model/test_client.rb +461 -0
- data/test/authlete/model/test_named-uri.rb +85 -0
- data/test/authlete/model/test_pair.rb +85 -0
- data/test/authlete/model/test_property.rb +90 -0
- data/test/authlete/model/test_result.rb +68 -0
- data/test/authlete/model/test_scope.rb +106 -0
- data/test/authlete/model/test_service-owner.rb +80 -0
- data/test/authlete/model/test_service.rb +614 -0
- data/test/authlete/model/test_sns-credentials.rb +88 -0
- data/test/authlete/model/test_tagged-value.rb +83 -0
- data/test/authlete/test_exception.rb +70 -0
- metadata +173 -13
- data/lib/authlete/model/client-list.rb +0 -129
- data/lib/authlete/model/response/client-authorization-get-list-response.rb +0 -60
- data/lib/authlete/model/response/service-creatable-response.rb +0 -51
- data/lib/authlete/model/service-list.rb +0 -128
@@ -0,0 +1,87 @@
|
|
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
|
@@ -0,0 +1,68 @@
|
|
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
|
@@ -0,0 +1,107 @@
|
|
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
|
@@ -0,0 +1,95 @@
|
|
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
|
+
|
29
|
+
|
30
|
+
def generate_json
|
31
|
+
return <<~JSON
|
32
|
+
{
|
33
|
+
"requestableScopes": [ "<requestable-scope0>", "<requestable-scope1>" ],
|
34
|
+
"requestableScopesEnabled": true,
|
35
|
+
"accessTokenDuration": 10000,
|
36
|
+
"refreshTokenDuration": 10000
|
37
|
+
}
|
38
|
+
JSON
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
def generate_hash
|
43
|
+
{
|
44
|
+
requestableScopes: %w(<requestable-scope0> <requestable-scope1>),
|
45
|
+
requestableScopesEnabled: true,
|
46
|
+
accessTokenDuration: 10000,
|
47
|
+
refreshTokenDuration: 10000
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
def set_params(obj)
|
53
|
+
obj.requestable_scopes = REQUESTABLE_SCOPES
|
54
|
+
obj.requestable_scopes_enabled = REQUESTABLE_SCOPES_ENABLED
|
55
|
+
obj.access_token_duration = ACCESS_TOKEN_DURATION
|
56
|
+
obj.refresh_token_duration = REFRESH_TOKEN_DURATION
|
57
|
+
|
58
|
+
obj
|
59
|
+
end
|
60
|
+
|
61
|
+
|
62
|
+
def match(obj)
|
63
|
+
assert_equal REQUESTABLE_SCOPES, obj.requestableScopes
|
64
|
+
assert_equal REQUESTABLE_SCOPES_ENABLED, obj.requestableScopesEnabled
|
65
|
+
assert_equal ACCESS_TOKEN_DURATION, obj.accessTokenDuration
|
66
|
+
assert_equal REFRESH_TOKEN_DURATION, obj.refreshTokenDuration
|
67
|
+
end
|
68
|
+
|
69
|
+
|
70
|
+
def test_from_json
|
71
|
+
jsn = generate_json
|
72
|
+
hsh = JSON.parse(jsn)
|
73
|
+
actual = Authlete::Model::ClientExtension.new(hsh)
|
74
|
+
|
75
|
+
match(actual)
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
def test_setters
|
80
|
+
actual = Authlete::Model::ClientExtension.new
|
81
|
+
set_params(actual)
|
82
|
+
|
83
|
+
match(actual)
|
84
|
+
end
|
85
|
+
|
86
|
+
|
87
|
+
def test_to_hash
|
88
|
+
obj = Authlete::Model::ClientExtension.new
|
89
|
+
set_params(obj)
|
90
|
+
actual = obj.to_hash
|
91
|
+
expected = generate_hash
|
92
|
+
|
93
|
+
assert_equal expected, actual
|
94
|
+
end
|
95
|
+
end
|
@@ -0,0 +1,461 @@
|
|
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 ClientTest < Minitest::Test
|
24
|
+
NUMBER = 100
|
25
|
+
SERVICE_NUMBER = 1000
|
26
|
+
DEVELOPER = '<developer>'
|
27
|
+
CLIENT_ID = 12345
|
28
|
+
CLIENT_ID_ALIAS = '<client-id-alias>'
|
29
|
+
CLIENT_ID_ALIAS_ENABLED = true
|
30
|
+
CLIENT_SECRET = '<client-secret>'
|
31
|
+
CLIENT_TYPE = 'PUBLIC'
|
32
|
+
REDIRECT_URIS = [ '<redirect-uri0>', '<redirect-uri1>' ]
|
33
|
+
RESPONSE_TYPES = [ 'NONE', 'CODE', 'TOKEN', 'ID_TOKEN' ]
|
34
|
+
GRANT_TYPES = [ 'AUTHORIZATION_CODE', 'REFRESH_TOKEN' ]
|
35
|
+
APPLICATION_TYPE = 'WEB'
|
36
|
+
CONTACTS = [ '<contact0>', '<contact1>' ]
|
37
|
+
CLIENT_NAME = '<client-name>'
|
38
|
+
CLIENT_NAME_TAG = '<client-name0-tag>'
|
39
|
+
CLIENT_NAME_VALUE = '<client-name0-value>'
|
40
|
+
CLIENT_NAMES = [ Authlete::Model::TaggedValue.new(tag: CLIENT_NAME_TAG, value: CLIENT_NAME_VALUE) ]
|
41
|
+
LOGO_URI = '<logo-uri>'
|
42
|
+
LOGO_URI_TAG = '<logo-uri0-tag>'
|
43
|
+
LOGO_URI_VALUE = '<logo-uri0-value>'
|
44
|
+
LOGO_URIS = [ Authlete::Model::TaggedValue.new(tag: LOGO_URI_TAG, value: LOGO_URI_VALUE) ]
|
45
|
+
CLIENT_URI = '<client-uri>'
|
46
|
+
CLIENT_URI_TAG = '<client-uri0-tag>'
|
47
|
+
CLIENT_URI_VALUE = '<client-uri0-value>'
|
48
|
+
CLIENT_URIS = [ Authlete::Model::TaggedValue.new(tag: CLIENT_URI_TAG, value: CLIENT_URI_VALUE) ]
|
49
|
+
POLICY_URI = '<policy-uri>'
|
50
|
+
POLICY_URI_TAG = '<policy-uri0-tag>'
|
51
|
+
POLICY_URI_VALUE = '<policy-uri0-value>'
|
52
|
+
POLICY_URIS = [ Authlete::Model::TaggedValue.new(tag: POLICY_URI_TAG, value: POLICY_URI_VALUE) ]
|
53
|
+
TOS_URI = '<tos-uri>'
|
54
|
+
TOS_URI_TAG = '<tos-uri0-tag>'
|
55
|
+
TOS_URI_VALUE = '<tos-uri0-value>'
|
56
|
+
TOS_URIS = [ Authlete::Model::TaggedValue.new(tag: TOS_URI_TAG, value: TOS_URI_VALUE) ]
|
57
|
+
JWKS_URI = '<jwks-uri>'
|
58
|
+
JWKS = '<jwks>'
|
59
|
+
DERIVED_SECTOR_IDENTIFIER = '<derived-sector-identifier>'
|
60
|
+
SECTOR_IDENTIFIER_URI = '<sector-identifier-uri>'
|
61
|
+
SUBJECT_TYPE = 'PUBLIC'
|
62
|
+
ID_TOKEN_SIGN_ALG = 'HS256'
|
63
|
+
ID_TOKEN_ENCRYPTION_ALG = 'PBES2_HS256_A128KW'
|
64
|
+
ID_TOKEN_ENCRYPTION_ENC = 'A128CBC_HS256'
|
65
|
+
USER_INFO_SIGN_ALG = 'HS256'
|
66
|
+
USER_INFO_ENCRYPTION_ALG = 'PBES2_HS256_A128KW'
|
67
|
+
USER_INFO_ENCRYPTION_ENC = 'A128CBC_HS256'
|
68
|
+
REQUEST_SIGN_ALG = 'HS256'
|
69
|
+
REQUEST_ENCRYPTION_ALG = 'PBES2_HS256_A128KW'
|
70
|
+
REQUEST_ENCRYPTION_ENC = 'A128CBC_HS256'
|
71
|
+
TOKEN_AUTH_METHOD = 'CLIENT_SECRET_BASIC'
|
72
|
+
TOKEN_AUTH_SIGN_ALG = 'HS256'
|
73
|
+
DEFAULT_MAX_AGE = 1000
|
74
|
+
DEFAULT_ACRS = [ '<default-acr0>', '<default-acr1>' ]
|
75
|
+
AUTH_TIME_REQUIRED = true
|
76
|
+
LOGIN_URI = '<login-uri>'
|
77
|
+
REQUEST_URIS = [ '<request-uri0>', '<request-uri1>' ]
|
78
|
+
DESCRIPTION = '<description>'
|
79
|
+
DESCRIPTION_TAG = '<description0-tag>'
|
80
|
+
DESCRIPTION_VALUE = '<description0-value>'
|
81
|
+
DESCRIPTIONS = [ Authlete::Model::TaggedValue.new(tag: DESCRIPTION_TAG, value: DESCRIPTION_VALUE) ]
|
82
|
+
CREATED_AT = 10000
|
83
|
+
MODIFIED_AT = 10000
|
84
|
+
REQUESTABLE_SCOPES = [ '<requestable-scope0>', '<requestable-scope1>' ]
|
85
|
+
REQUESTABLE_SCOPES_ENABLED = true
|
86
|
+
ACCESS_TOKEN_DURATION = 10000
|
87
|
+
REFRESH_TOKEN_DURATION = 10000
|
88
|
+
EXTENSION = Authlete::Model::ClientExtension.new(
|
89
|
+
requestableScopes: REQUESTABLE_SCOPES,
|
90
|
+
requestableScopesEnabled: REQUESTABLE_SCOPES_ENABLED,
|
91
|
+
accessTokenDuration: ACCESS_TOKEN_DURATION,
|
92
|
+
refreshTokenDuration: REFRESH_TOKEN_DURATION
|
93
|
+
)
|
94
|
+
TLS_CLIENT_AUTH_SUBJECT_DN = '<tls-client-auth-subject-dn>'
|
95
|
+
TLS_CLIENT_AUTH_SAN_DNS = '<tls-client-auth-san-dns>'
|
96
|
+
TLS_CLIENT_AUTH_SAN_URI = '<tls-client-auth-san-uri>'
|
97
|
+
TLS_CLIENT_AUTH_SAN_IP = '<tls-client-auth-san-ip>'
|
98
|
+
TLS_CLIENT_AUTH_SAN_EMAIL = '<tls-client-auth-san-email>'
|
99
|
+
TLS_CLIENT_CERTIFICATE_BOUND_ACCESS_TOKENS = false
|
100
|
+
SELF_SIGNED_CERTIFICATE_KEY_ID = '<self-signed-certificate-key-id>'
|
101
|
+
SOFTWARE_ID = '<software-id>'
|
102
|
+
SOFTWARE_VERSION = '<software-version>'
|
103
|
+
AUTHORIZATION_SIGN_ALG = 'HS256'
|
104
|
+
AUTHORIZATION_ENCRYPTION_ALG = 'PBES2_HS256_A128KW'
|
105
|
+
AUTHORIZATION_ENCRYPTION_ENC = 'A128CBC_HS256'
|
106
|
+
BC_DELIVERY_MODE = 'POLL'
|
107
|
+
BC_NOTIFICATION_ENDPOINT = '<bc-notification-endpoint>'
|
108
|
+
BC_REQUEST_SIGN_ALG = 'HS256'
|
109
|
+
BC_USER_CODE_REQUIRED = true
|
110
|
+
DYNAMICALLY_REGISTERED = false
|
111
|
+
REGISTRATION_ACCESS_TOKEN_HASH = '<registration-access-token-hash>'
|
112
|
+
AUTHORIZATION_DATA_TYPES = [ '<authorization-data-type0>', '<authorization-data-type1>' ]
|
113
|
+
PAR_REQUIRED = false
|
114
|
+
REQUEST_OBJECT_REQUIRED = true
|
115
|
+
|
116
|
+
|
117
|
+
def generate_json
|
118
|
+
return <<~JSON
|
119
|
+
{
|
120
|
+
"number": 100,
|
121
|
+
"serviceNumber": 1000,
|
122
|
+
"developer": "<developer>",
|
123
|
+
"clientId": 12345,
|
124
|
+
"clientIdAlias": "<client-id-alias>",
|
125
|
+
"clientIdAliasEnabled": true,
|
126
|
+
"clientSecret": "<client-secret>",
|
127
|
+
"clientType": "PUBLIC",
|
128
|
+
"redirectUris": [ "<redirect-uri0>", "<redirect-uri1>" ],
|
129
|
+
"responseTypes": [ "NONE", "CODE", "TOKEN", "ID_TOKEN" ],
|
130
|
+
"grantTypes": [ "AUTHORIZATION_CODE", "REFRESH_TOKEN" ],
|
131
|
+
"applicationType": "WEB",
|
132
|
+
"contacts": [ "<contact0>", "<contact1>" ],
|
133
|
+
"clientName": "<client-name>",
|
134
|
+
"clientNames": [{ "tag": "<client-name0-tag>", "value": "<client-name0-value>" }],
|
135
|
+
"logoUri": "<logo-uri>",
|
136
|
+
"logoUris": [{ "tag": "<logo-uri0-tag>", "value": "<logo-uri0-value>" }],
|
137
|
+
"clientUri": "<client-uri>",
|
138
|
+
"clientUris": [{ "tag": "<client-uri0-tag>", "value": "<client-uri0-value>" }],
|
139
|
+
"policyUri": "<policy-uri>",
|
140
|
+
"policyUris": [{ "tag": "<policy-uri0-tag>", "value": "<policy-uri0-value>" }],
|
141
|
+
"tosUri": "<tos-uri>",
|
142
|
+
"tosUris": [{ "tag": "<tos-uri0-tag>", "value": "<tos-uri0-value>" }],
|
143
|
+
"jwksUri": "<jwks-uri>",
|
144
|
+
"jwks": "<jwks>",
|
145
|
+
"derivedSectorIdentifier": "<derived-sector-identifier>",
|
146
|
+
"sectorIdentifierUri": "<sector-identifier-uri>",
|
147
|
+
"subjectType": "PUBLIC",
|
148
|
+
"idTokenSignAlg": "HS256",
|
149
|
+
"idTokenEncryptionAlg": "PBES2_HS256_A128KW",
|
150
|
+
"idTokenEncryptionEnc": "A128CBC_HS256",
|
151
|
+
"userInfoSignAlg": "HS256",
|
152
|
+
"userInfoEncryptionAlg": "PBES2_HS256_A128KW",
|
153
|
+
"userInfoEncryptionEnc": "A128CBC_HS256",
|
154
|
+
"requestSignAlg": "HS256",
|
155
|
+
"requestEncryptionAlg": "PBES2_HS256_A128KW",
|
156
|
+
"requestEncryptionEnc": "A128CBC_HS256",
|
157
|
+
"tokenAuthMethod": "CLIENT_SECRET_BASIC",
|
158
|
+
"tokenAuthSignAlg": "HS256",
|
159
|
+
"defaultMaxAge": 1000,
|
160
|
+
"defaultAcrs": [ "<default-acr0>", "<default-acr1>" ],
|
161
|
+
"authTimeRequired": true,
|
162
|
+
"loginUri": "<login-uri>",
|
163
|
+
"requestUris": [ "<request-uri0>", "<request-uri1>" ],
|
164
|
+
"description": "<description>",
|
165
|
+
"descriptions": [{ "tag": "<description0-tag>", "value": "<description0-value>" }],
|
166
|
+
"createdAt": 10000,
|
167
|
+
"modifiedAt": 10000,
|
168
|
+
"extension": {
|
169
|
+
"requestableScopes": [ "<requestable-scope0>", "<requestable-scope1>" ],
|
170
|
+
"requestableScopesEnabled": true,
|
171
|
+
"accessTokenDuration": 10000,
|
172
|
+
"refreshTokenDuration": 10000
|
173
|
+
},
|
174
|
+
"tlsClientAuthSubjectDn": "<tls-client-auth-subject-dn>",
|
175
|
+
"tlsClientAuthSanDns": "<tls-client-auth-san-dns>",
|
176
|
+
"tlsClientAuthSanUri": "<tls-client-auth-san-uri>",
|
177
|
+
"tlsClientAuthSanIp": "<tls-client-auth-san-ip>",
|
178
|
+
"tlsClientAuthSanEmail": "<tls-client-auth-san-email>",
|
179
|
+
"tlsClientCertificateBoundAccessTokens": false,
|
180
|
+
"selfSignedCertificateKeyId": "<self-signed-certificate-key-id>",
|
181
|
+
"softwareId": "<software-id>",
|
182
|
+
"softwareVersion": "<software-version>",
|
183
|
+
"authorizationSignAlg": "HS256",
|
184
|
+
"authorizationEncryptionAlg": "PBES2_HS256_A128KW",
|
185
|
+
"authorizationEncryptionEnc": "A128CBC_HS256",
|
186
|
+
"bcDeliveryMode": "POLL",
|
187
|
+
"bcNotificationEndpoint": "<bc-notification-endpoint>",
|
188
|
+
"bcRequestSignAlg": "HS256",
|
189
|
+
"bcUserCodeRequired": true,
|
190
|
+
"dynamicallyRegistered": false,
|
191
|
+
"registrationAccessTokenHash": "<registration-access-token-hash>",
|
192
|
+
"authorizationDataTypes": [ "<authorization-data-type0>", "<authorization-data-type1>" ],
|
193
|
+
"parRequired": false,
|
194
|
+
"requestObjectRequired": true
|
195
|
+
}
|
196
|
+
JSON
|
197
|
+
end
|
198
|
+
|
199
|
+
|
200
|
+
def generate_hash
|
201
|
+
{
|
202
|
+
number: 100,
|
203
|
+
serviceNumber: 1000,
|
204
|
+
developer: '<developer>',
|
205
|
+
clientId: 12345,
|
206
|
+
clientIdAlias: '<client-id-alias>',
|
207
|
+
clientIdAliasEnabled: true,
|
208
|
+
clientSecret: '<client-secret>',
|
209
|
+
clientType: 'PUBLIC',
|
210
|
+
redirectUris: [ '<redirect-uri0>', '<redirect-uri1>' ],
|
211
|
+
responseTypes: [ 'NONE', 'CODE', 'TOKEN', 'ID_TOKEN' ],
|
212
|
+
grantTypes: [ 'AUTHORIZATION_CODE', 'REFRESH_TOKEN' ],
|
213
|
+
applicationType: 'WEB',
|
214
|
+
contacts: [ '<contact0>', '<contact1>' ],
|
215
|
+
clientName: '<client-name>',
|
216
|
+
clientNames: [{ tag: '<client-name0-tag>', value: '<client-name0-value>' }],
|
217
|
+
logoUri: '<logo-uri>',
|
218
|
+
logoUris: [{ tag: '<logo-uri0-tag>', value: '<logo-uri0-value>' }],
|
219
|
+
clientUri: '<client-uri>',
|
220
|
+
clientUris: [{ tag: '<client-uri0-tag>', value: '<client-uri0-value>' }],
|
221
|
+
policyUri: '<policy-uri>',
|
222
|
+
policyUris: [{ tag: '<policy-uri0-tag>', value: '<policy-uri0-value>' }],
|
223
|
+
tosUri: '<tos-uri>',
|
224
|
+
tosUris: [{ tag: '<tos-uri0-tag>', value: '<tos-uri0-value>' }],
|
225
|
+
jwksUri: '<jwks-uri>',
|
226
|
+
jwks: '<jwks>',
|
227
|
+
derivedSectorIdentifier: '<derived-sector-identifier>',
|
228
|
+
sectorIdentifierUri: '<sector-identifier-uri>',
|
229
|
+
subjectType: 'PUBLIC',
|
230
|
+
idTokenSignAlg: 'HS256',
|
231
|
+
idTokenEncryptionAlg: 'PBES2_HS256_A128KW',
|
232
|
+
idTokenEncryptionEnc: 'A128CBC_HS256',
|
233
|
+
userInfoSignAlg: 'HS256',
|
234
|
+
userInfoEncryptionAlg: 'PBES2_HS256_A128KW',
|
235
|
+
userInfoEncryptionEnc: 'A128CBC_HS256',
|
236
|
+
requestSignAlg: 'HS256',
|
237
|
+
requestEncryptionAlg: 'PBES2_HS256_A128KW',
|
238
|
+
requestEncryptionEnc: 'A128CBC_HS256',
|
239
|
+
tokenAuthMethod: 'CLIENT_SECRET_BASIC',
|
240
|
+
tokenAuthSignAlg: 'HS256',
|
241
|
+
defaultMaxAge: 1000,
|
242
|
+
defaultAcrs: [ '<default-acr0>', '<default-acr1>' ],
|
243
|
+
authTimeRequired: true,
|
244
|
+
loginUri: '<login-uri>',
|
245
|
+
requestUris: [ '<request-uri0>', '<request-uri1>' ],
|
246
|
+
description: '<description>',
|
247
|
+
descriptions: [{ tag: '<description0-tag>', value: '<description0-value>' }],
|
248
|
+
createdAt: 10000,
|
249
|
+
modifiedAt: 10000,
|
250
|
+
extension: {
|
251
|
+
requestableScopes: [ '<requestable-scope0>', '<requestable-scope1>' ],
|
252
|
+
requestableScopesEnabled: true,
|
253
|
+
accessTokenDuration: 10000,
|
254
|
+
refreshTokenDuration: 10000
|
255
|
+
},
|
256
|
+
tlsClientAuthSubjectDn: '<tls-client-auth-subject-dn>',
|
257
|
+
tlsClientAuthSanDns: '<tls-client-auth-san-dns>',
|
258
|
+
tlsClientAuthSanUri: '<tls-client-auth-san-uri>',
|
259
|
+
tlsClientAuthSanIp: '<tls-client-auth-san-ip>',
|
260
|
+
tlsClientAuthSanEmail: '<tls-client-auth-san-email>',
|
261
|
+
tlsClientCertificateBoundAccessTokens: false,
|
262
|
+
selfSignedCertificateKeyId: '<self-signed-certificate-key-id>',
|
263
|
+
softwareId: '<software-id>',
|
264
|
+
softwareVersion: '<software-version>',
|
265
|
+
authorizationSignAlg: 'HS256',
|
266
|
+
authorizationEncryptionAlg: 'PBES2_HS256_A128KW',
|
267
|
+
authorizationEncryptionEnc: 'A128CBC_HS256',
|
268
|
+
bcDeliveryMode: 'POLL',
|
269
|
+
bcNotificationEndpoint: '<bc-notification-endpoint>',
|
270
|
+
bcRequestSignAlg: 'HS256',
|
271
|
+
bcUserCodeRequired: true,
|
272
|
+
dynamicallyRegistered: false,
|
273
|
+
registrationAccessTokenHash: '<registration-access-token-hash>',
|
274
|
+
authorizationDataTypes: [ '<authorization-data-type0>', '<authorization-data-type1>' ],
|
275
|
+
parRequired: false,
|
276
|
+
requestObjectRequired: true
|
277
|
+
}
|
278
|
+
end
|
279
|
+
|
280
|
+
|
281
|
+
def set_params(obj)
|
282
|
+
obj.number = NUMBER
|
283
|
+
obj.service_number = SERVICE_NUMBER
|
284
|
+
obj.developer = DEVELOPER
|
285
|
+
obj.client_id = CLIENT_ID
|
286
|
+
obj.client_id_alias = CLIENT_ID_ALIAS
|
287
|
+
obj.client_id_alias_enabled = CLIENT_ID_ALIAS_ENABLED
|
288
|
+
obj.client_secret = CLIENT_SECRET
|
289
|
+
obj.client_type = CLIENT_TYPE
|
290
|
+
obj.redirect_uris = REDIRECT_URIS
|
291
|
+
obj.response_types = RESPONSE_TYPES
|
292
|
+
obj.grant_types = GRANT_TYPES
|
293
|
+
obj.application_type = APPLICATION_TYPE
|
294
|
+
obj.contacts = CONTACTS
|
295
|
+
obj.client_name = CLIENT_NAME
|
296
|
+
obj.client_names = CLIENT_NAMES
|
297
|
+
obj.logo_uri = LOGO_URI
|
298
|
+
obj.logo_uris = LOGO_URIS
|
299
|
+
obj.client_uri = CLIENT_URI
|
300
|
+
obj.client_uris = CLIENT_URIS
|
301
|
+
obj.policy_uri = POLICY_URI
|
302
|
+
obj.policy_uris = POLICY_URIS
|
303
|
+
obj.tos_uri = TOS_URI
|
304
|
+
obj.tos_uris = TOS_URIS
|
305
|
+
obj.jwks_uri = JWKS_URI
|
306
|
+
obj.jwks = JWKS
|
307
|
+
obj.derived_sector_identifier = DERIVED_SECTOR_IDENTIFIER
|
308
|
+
obj.sector_identifier_uri = SECTOR_IDENTIFIER_URI
|
309
|
+
obj.subject_type = SUBJECT_TYPE
|
310
|
+
obj.id_token_sign_alg = ID_TOKEN_SIGN_ALG
|
311
|
+
obj.id_token_encryption_alg = ID_TOKEN_ENCRYPTION_ALG
|
312
|
+
obj.id_token_encryption_enc = ID_TOKEN_ENCRYPTION_ENC
|
313
|
+
obj.user_info_sign_alg = USER_INFO_SIGN_ALG
|
314
|
+
obj.user_info_encryption_alg = USER_INFO_ENCRYPTION_ALG
|
315
|
+
obj.user_info_encryption_enc = USER_INFO_ENCRYPTION_ENC
|
316
|
+
obj.request_sign_alg = REQUEST_SIGN_ALG
|
317
|
+
obj.request_encryption_alg = REQUEST_ENCRYPTION_ALG
|
318
|
+
obj.request_encryption_enc = REQUEST_ENCRYPTION_ENC
|
319
|
+
obj.token_auth_method = TOKEN_AUTH_METHOD
|
320
|
+
obj.token_auth_sign_alg = TOKEN_AUTH_SIGN_ALG
|
321
|
+
obj.default_max_age = DEFAULT_MAX_AGE
|
322
|
+
obj.default_acrs = DEFAULT_ACRS
|
323
|
+
obj.auth_time_required = AUTH_TIME_REQUIRED
|
324
|
+
obj.login_uri = LOGIN_URI
|
325
|
+
obj.request_uris = REQUEST_URIS
|
326
|
+
obj.description = DESCRIPTION
|
327
|
+
obj.descriptions = DESCRIPTIONS
|
328
|
+
obj.created_at = CREATED_AT
|
329
|
+
obj.modified_at = MODIFIED_AT
|
330
|
+
obj.extension = EXTENSION
|
331
|
+
obj.tls_client_auth_subject_dn = TLS_CLIENT_AUTH_SUBJECT_DN
|
332
|
+
obj.tls_client_auth_san_dns = TLS_CLIENT_AUTH_SAN_DNS
|
333
|
+
obj.tls_client_auth_san_uri = TLS_CLIENT_AUTH_SAN_URI
|
334
|
+
obj.tls_client_auth_san_ip = TLS_CLIENT_AUTH_SAN_IP
|
335
|
+
obj.tls_client_auth_san_email = TLS_CLIENT_AUTH_SAN_EMAIL
|
336
|
+
obj.tls_client_certificate_bound_access_tokens = TLS_CLIENT_CERTIFICATE_BOUND_ACCESS_TOKENS
|
337
|
+
obj.self_signed_certificate_key_id = SELF_SIGNED_CERTIFICATE_KEY_ID
|
338
|
+
obj.software_id = SOFTWARE_ID
|
339
|
+
obj.software_version = SOFTWARE_VERSION
|
340
|
+
obj.authorization_sign_alg = AUTHORIZATION_SIGN_ALG
|
341
|
+
obj.authorization_encryption_alg = AUTHORIZATION_ENCRYPTION_ALG
|
342
|
+
obj.authorization_encryption_enc = AUTHORIZATION_ENCRYPTION_ENC
|
343
|
+
obj.bc_delivery_mode = BC_DELIVERY_MODE
|
344
|
+
obj.bc_notification_endpoint = BC_NOTIFICATION_ENDPOINT
|
345
|
+
obj.bc_request_sign_alg = BC_REQUEST_SIGN_ALG
|
346
|
+
obj.bc_user_code_required = BC_USER_CODE_REQUIRED
|
347
|
+
obj.dynamically_registered = DYNAMICALLY_REGISTERED
|
348
|
+
obj.registration_access_token_hash = REGISTRATION_ACCESS_TOKEN_HASH
|
349
|
+
obj.authorization_data_types = AUTHORIZATION_DATA_TYPES
|
350
|
+
obj.par_required = PAR_REQUIRED
|
351
|
+
obj.request_object_required = REQUEST_OBJECT_REQUIRED
|
352
|
+
end
|
353
|
+
|
354
|
+
|
355
|
+
def match(obj)
|
356
|
+
assert_equal NUMBER, obj.number
|
357
|
+
assert_equal SERVICE_NUMBER, obj.serviceNumber
|
358
|
+
assert_equal DEVELOPER, obj.developer
|
359
|
+
assert_equal CLIENT_ID, obj.clientId
|
360
|
+
assert_equal CLIENT_ID_ALIAS, obj.clientIdAlias
|
361
|
+
assert_equal CLIENT_ID_ALIAS_ENABLED, obj.clientIdAliasEnabled
|
362
|
+
assert_equal CLIENT_SECRET, obj.clientSecret
|
363
|
+
assert_equal CLIENT_TYPE, obj.clientType
|
364
|
+
assert_equal REDIRECT_URIS, obj.redirectUris
|
365
|
+
assert_equal RESPONSE_TYPES, obj.responseTypes
|
366
|
+
assert_equal GRANT_TYPES, obj.grantTypes
|
367
|
+
assert_equal APPLICATION_TYPE, obj.applicationType
|
368
|
+
assert_equal CONTACTS, obj.contacts
|
369
|
+
assert_equal CLIENT_NAME, obj.clientName
|
370
|
+
assert_equal CLIENT_NAME_TAG, obj.clientNames[0].tag
|
371
|
+
assert_equal CLIENT_NAME_VALUE, obj.clientNames[0].value
|
372
|
+
assert_equal LOGO_URI, obj.logoUri
|
373
|
+
assert_equal LOGO_URI_TAG, obj.logoUris[0].tag
|
374
|
+
assert_equal LOGO_URI_VALUE, obj.logoUris[0].value
|
375
|
+
assert_equal CLIENT_URI, obj.clientUri
|
376
|
+
assert_equal CLIENT_URI_TAG, obj.clientUris[0].tag
|
377
|
+
assert_equal CLIENT_URI_VALUE, obj.clientUris[0].value
|
378
|
+
assert_equal POLICY_URI, obj.policyUri
|
379
|
+
assert_equal POLICY_URI_TAG, obj.policyUris[0].tag
|
380
|
+
assert_equal POLICY_URI_VALUE, obj.policyUris[0].value
|
381
|
+
assert_equal TOS_URI, obj.tosUri
|
382
|
+
assert_equal TOS_URI_TAG, obj.tosUris[0].tag
|
383
|
+
assert_equal TOS_URI_VALUE, obj.tosUris[0].value
|
384
|
+
assert_equal JWKS_URI, obj.jwksUri
|
385
|
+
assert_equal JWKS, obj.jwks
|
386
|
+
assert_equal DERIVED_SECTOR_IDENTIFIER, obj.derivedSectorIdentifier
|
387
|
+
assert_equal SECTOR_IDENTIFIER_URI, obj.sectorIdentifierUri
|
388
|
+
assert_equal SUBJECT_TYPE, obj.subjectType
|
389
|
+
assert_equal ID_TOKEN_SIGN_ALG, obj.idTokenSignAlg
|
390
|
+
assert_equal ID_TOKEN_ENCRYPTION_ALG, obj.idTokenEncryptionAlg
|
391
|
+
assert_equal ID_TOKEN_ENCRYPTION_ENC, obj.idTokenEncryptionEnc
|
392
|
+
assert_equal USER_INFO_SIGN_ALG, obj.userInfoSignAlg
|
393
|
+
assert_equal USER_INFO_ENCRYPTION_ALG, obj.userInfoEncryptionAlg
|
394
|
+
assert_equal USER_INFO_ENCRYPTION_ENC, obj.userInfoEncryptionEnc
|
395
|
+
assert_equal REQUEST_SIGN_ALG, obj.requestSignAlg
|
396
|
+
assert_equal REQUEST_ENCRYPTION_ALG, obj.requestEncryptionAlg
|
397
|
+
assert_equal REQUEST_ENCRYPTION_ENC, obj.requestEncryptionEnc
|
398
|
+
assert_equal TOKEN_AUTH_METHOD, obj.tokenAuthMethod
|
399
|
+
assert_equal TOKEN_AUTH_SIGN_ALG, obj.tokenAuthSignAlg
|
400
|
+
assert_equal DEFAULT_MAX_AGE, obj.defaultMaxAge
|
401
|
+
assert_equal DEFAULT_ACRS, obj.defaultAcrs
|
402
|
+
assert_equal AUTH_TIME_REQUIRED, obj.authTimeRequired
|
403
|
+
assert_equal LOGIN_URI, obj.loginUri
|
404
|
+
assert_equal REQUEST_URIS, obj.requestUris
|
405
|
+
assert_equal DESCRIPTION, obj.description
|
406
|
+
assert_equal DESCRIPTION_TAG, obj.descriptions[0].tag
|
407
|
+
assert_equal DESCRIPTION_VALUE, obj.descriptions[0].value
|
408
|
+
assert_equal CREATED_AT, obj.createdAt
|
409
|
+
assert_equal MODIFIED_AT, obj.modifiedAt
|
410
|
+
assert_equal REQUESTABLE_SCOPES, obj.extension.requestableScopes
|
411
|
+
assert_equal REQUESTABLE_SCOPES_ENABLED, obj.extension.requestableScopesEnabled
|
412
|
+
assert_equal ACCESS_TOKEN_DURATION, obj.extension.accessTokenDuration
|
413
|
+
assert_equal REFRESH_TOKEN_DURATION, obj.extension.refreshTokenDuration
|
414
|
+
assert_equal TLS_CLIENT_AUTH_SUBJECT_DN, obj.tlsClientAuthSubjectDn
|
415
|
+
assert_equal TLS_CLIENT_AUTH_SAN_DNS, obj.tlsClientAuthSanDns
|
416
|
+
assert_equal TLS_CLIENT_AUTH_SAN_URI, obj.tlsClientAuthSanUri
|
417
|
+
assert_equal TLS_CLIENT_AUTH_SAN_IP, obj.tlsClientAuthSanIp
|
418
|
+
assert_equal TLS_CLIENT_AUTH_SAN_EMAIL, obj.tlsClientAuthSanEmail
|
419
|
+
assert_equal TLS_CLIENT_CERTIFICATE_BOUND_ACCESS_TOKENS, obj.tlsClientCertificateBoundAccessTokens
|
420
|
+
assert_equal SELF_SIGNED_CERTIFICATE_KEY_ID, obj.selfSignedCertificateKeyId
|
421
|
+
assert_equal AUTHORIZATION_SIGN_ALG, obj.authorizationSignAlg
|
422
|
+
assert_equal AUTHORIZATION_ENCRYPTION_ALG, obj.authorizationEncryptionAlg
|
423
|
+
assert_equal AUTHORIZATION_ENCRYPTION_ENC, obj.authorizationEncryptionEnc
|
424
|
+
assert_equal BC_DELIVERY_MODE, obj.bcDeliveryMode
|
425
|
+
assert_equal BC_NOTIFICATION_ENDPOINT, obj.bcNotificationEndpoint
|
426
|
+
assert_equal BC_REQUEST_SIGN_ALG, obj.bcRequestSignAlg
|
427
|
+
assert_equal BC_USER_CODE_REQUIRED, obj.bcUserCodeRequired
|
428
|
+
assert_equal DYNAMICALLY_REGISTERED, obj.dynamicallyRegistered
|
429
|
+
assert_equal REGISTRATION_ACCESS_TOKEN_HASH, obj.registrationAccessTokenHash
|
430
|
+
assert_equal AUTHORIZATION_DATA_TYPES, obj.authorizationDataTypes
|
431
|
+
assert_equal PAR_REQUIRED, obj.parRequired
|
432
|
+
assert_equal REQUEST_OBJECT_REQUIRED, obj.requestObjectRequired
|
433
|
+
end
|
434
|
+
|
435
|
+
|
436
|
+
def test_from_json
|
437
|
+
jsn = generate_json
|
438
|
+
hsh = JSON.parse(jsn)
|
439
|
+
actual = Authlete::Model::Client.new(hsh)
|
440
|
+
|
441
|
+
match(actual)
|
442
|
+
end
|
443
|
+
|
444
|
+
|
445
|
+
def test_setters
|
446
|
+
actual = Authlete::Model::Client.new
|
447
|
+
set_params(actual)
|
448
|
+
|
449
|
+
match(actual)
|
450
|
+
end
|
451
|
+
|
452
|
+
|
453
|
+
def test_to_hash
|
454
|
+
obj = Authlete::Model::Client.new
|
455
|
+
set_params(obj)
|
456
|
+
actual = obj.to_hash
|
457
|
+
expected = generate_hash
|
458
|
+
|
459
|
+
assert_equal expected, actual
|
460
|
+
end
|
461
|
+
end
|