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,88 +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 SnsCredentialsTest < Minitest::Test
|
24
|
-
SNS = 'FACEBOOK'
|
25
|
-
API_KEY = '<api-key>'
|
26
|
-
API_SECRET = '<api-secret>'
|
27
|
-
|
28
|
-
|
29
|
-
def generate_json
|
30
|
-
return <<~JSON
|
31
|
-
{
|
32
|
-
"sns": "FACEBOOK",
|
33
|
-
"apiKey": "<api-key>",
|
34
|
-
"apiSecret": "<api-secret>"
|
35
|
-
}
|
36
|
-
JSON
|
37
|
-
end
|
38
|
-
|
39
|
-
|
40
|
-
def generate_hash
|
41
|
-
{
|
42
|
-
sns: 'FACEBOOK',
|
43
|
-
apiKey: '<api-key>',
|
44
|
-
apiSecret: '<api-secret>'
|
45
|
-
}
|
46
|
-
end
|
47
|
-
|
48
|
-
|
49
|
-
def set_params(obj)
|
50
|
-
obj.sns = SNS
|
51
|
-
obj.api_key = API_KEY
|
52
|
-
obj.api_secret = API_SECRET
|
53
|
-
end
|
54
|
-
|
55
|
-
|
56
|
-
def match(obj)
|
57
|
-
assert_equal SNS, obj.sns
|
58
|
-
assert_equal API_KEY, obj.apiKey
|
59
|
-
assert_equal API_SECRET, obj.apiSecret
|
60
|
-
end
|
61
|
-
|
62
|
-
|
63
|
-
def test_from_json
|
64
|
-
jsn = generate_json
|
65
|
-
hsh = JSON.parse(jsn)
|
66
|
-
actual = Authlete::Model::SnsCredentials.new(hsh)
|
67
|
-
|
68
|
-
match(actual)
|
69
|
-
end
|
70
|
-
|
71
|
-
|
72
|
-
def test_setters
|
73
|
-
actual = Authlete::Model::SnsCredentials.new
|
74
|
-
set_params(actual)
|
75
|
-
|
76
|
-
match(actual)
|
77
|
-
end
|
78
|
-
|
79
|
-
|
80
|
-
def test_to_hash
|
81
|
-
obj = Authlete::Model::SnsCredentials.new
|
82
|
-
set_params(obj)
|
83
|
-
actual = obj.to_hash
|
84
|
-
expected = generate_hash
|
85
|
-
|
86
|
-
assert_equal expected, actual
|
87
|
-
end
|
88
|
-
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 TaggedValueTest < Minitest::Test
|
24
|
-
TAG = '<tag>'
|
25
|
-
VALUE = '<value>'
|
26
|
-
|
27
|
-
|
28
|
-
def generate_json
|
29
|
-
return <<~JSON
|
30
|
-
{
|
31
|
-
"tag": "<tag>",
|
32
|
-
"value": "<value>"
|
33
|
-
}
|
34
|
-
JSON
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
def generate_hash
|
39
|
-
{
|
40
|
-
tag: '<tag>',
|
41
|
-
value: '<value>'
|
42
|
-
}
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
def set_params(obj)
|
47
|
-
obj.tag = TAG
|
48
|
-
obj.value = VALUE
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
def match(obj)
|
53
|
-
assert_equal TAG, obj.tag
|
54
|
-
assert_equal VALUE, obj.value
|
55
|
-
end
|
56
|
-
|
57
|
-
|
58
|
-
def test_from_json
|
59
|
-
jsn = generate_json
|
60
|
-
hsh = JSON.parse(jsn)
|
61
|
-
actual = Authlete::Model::TaggedValue.new(hsh)
|
62
|
-
|
63
|
-
match(actual)
|
64
|
-
end
|
65
|
-
|
66
|
-
|
67
|
-
def test_setters
|
68
|
-
actual = Authlete::Model::TaggedValue.new
|
69
|
-
set_params(actual)
|
70
|
-
|
71
|
-
match(actual)
|
72
|
-
end
|
73
|
-
|
74
|
-
|
75
|
-
def test_to_hash
|
76
|
-
obj = Authlete::Model::TaggedValue.new
|
77
|
-
set_params(obj)
|
78
|
-
actual = obj.to_hash
|
79
|
-
expected = generate_hash
|
80
|
-
|
81
|
-
assert_equal expected, actual
|
82
|
-
end
|
83
|
-
end
|
@@ -1,84 +0,0 @@
|
|
1
|
-
# :nodoc:
|
2
|
-
#
|
3
|
-
# Copyright (C) 2014-2021 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 TrustAnchorTest < Minitest::Test
|
24
|
-
ENTITY_ID = '<entity-id>'
|
25
|
-
JWKS = '<jwks>'
|
26
|
-
|
27
|
-
|
28
|
-
def generate_json
|
29
|
-
return <<~JSON
|
30
|
-
{
|
31
|
-
"entityId": "<entity-id>",
|
32
|
-
"jwks": "<jwks>"
|
33
|
-
}
|
34
|
-
JSON
|
35
|
-
end
|
36
|
-
|
37
|
-
|
38
|
-
def generate_hash
|
39
|
-
{
|
40
|
-
entityId: '<entity-id>',
|
41
|
-
jwks: '<jwks>',
|
42
|
-
}
|
43
|
-
end
|
44
|
-
|
45
|
-
|
46
|
-
def set_params(obj)
|
47
|
-
obj.entity_id = ENTITY_ID
|
48
|
-
obj.jwks = JWKS
|
49
|
-
end
|
50
|
-
|
51
|
-
|
52
|
-
def match(obj)
|
53
|
-
assert_equal ENTITY_ID, obj.entityId
|
54
|
-
assert_equal JWKS, obj.jwks
|
55
|
-
end
|
56
|
-
|
57
|
-
|
58
|
-
def test_from_json
|
59
|
-
jsn = generate_json
|
60
|
-
hsh = JSON.parse(jsn)
|
61
|
-
|
62
|
-
actual = Authlete::Model::TrustAnchor.new(hsh)
|
63
|
-
|
64
|
-
match(actual)
|
65
|
-
end
|
66
|
-
|
67
|
-
|
68
|
-
def test_setters
|
69
|
-
actual = Authlete::Model::TrustAnchor.new
|
70
|
-
set_params(actual)
|
71
|
-
|
72
|
-
match(actual)
|
73
|
-
end
|
74
|
-
|
75
|
-
|
76
|
-
def test_to_hash
|
77
|
-
obj = Authlete::Model::TrustAnchor.new
|
78
|
-
set_params(obj)
|
79
|
-
actual = obj.to_hash
|
80
|
-
expected = generate_hash
|
81
|
-
|
82
|
-
assert_equal expected, actual
|
83
|
-
end
|
84
|
-
end
|
@@ -1,70 +0,0 @@
|
|
1
|
-
# :nodoc:
|
2
|
-
#
|
3
|
-
# Copyright (C) 2014-2020 Authlete, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
|
18
|
-
require 'authlete'
|
19
|
-
require 'json'
|
20
|
-
require 'minitest/autorun'
|
21
|
-
|
22
|
-
|
23
|
-
class ExceptionTest < Minitest::Test
|
24
|
-
MESSAGE = '<message>'
|
25
|
-
STATUS_CODE = 500
|
26
|
-
RESULT_CODE = '<result-code>'
|
27
|
-
RESULT_MESSAGE = '<result-message>'
|
28
|
-
RESULT = Authlete::Model::Result.new(resultCode: RESULT_CODE, resultMessage: RESULT_MESSAGE)
|
29
|
-
|
30
|
-
|
31
|
-
def generate_json
|
32
|
-
return <<~JSON
|
33
|
-
{
|
34
|
-
"message": "<message>",
|
35
|
-
"statusCode": 500,
|
36
|
-
"result": {
|
37
|
-
"resultCode": "<result-code>",
|
38
|
-
"resultMessage": "<result-message>"
|
39
|
-
}
|
40
|
-
}
|
41
|
-
JSON
|
42
|
-
end
|
43
|
-
|
44
|
-
|
45
|
-
def match(obj)
|
46
|
-
assert_equal MESSAGE, obj.message
|
47
|
-
assert_equal STATUS_CODE, obj.statusCode
|
48
|
-
assert_equal RESULT_CODE, obj.result.resultCode
|
49
|
-
assert_equal RESULT_MESSAGE, obj.result.resultMessage
|
50
|
-
end
|
51
|
-
|
52
|
-
|
53
|
-
def test_from_json
|
54
|
-
jsn = generate_json
|
55
|
-
hsh = JSON.parse(jsn)
|
56
|
-
actual = Authlete::Exception.new(hsh)
|
57
|
-
|
58
|
-
match(actual)
|
59
|
-
end
|
60
|
-
|
61
|
-
|
62
|
-
def test_setters
|
63
|
-
actual = Authlete::Exception.new
|
64
|
-
actual.message = MESSAGE
|
65
|
-
actual.status_code = STATUS_CODE
|
66
|
-
actual.result = RESULT
|
67
|
-
|
68
|
-
match(actual)
|
69
|
-
end
|
70
|
-
end
|
@@ -1,44 +0,0 @@
|
|
1
|
-
# :nodoc:
|
2
|
-
#
|
3
|
-
# Copyright (C) 2022 Authlete, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
|
18
|
-
require 'authlete'
|
19
|
-
require 'minitest/autorun'
|
20
|
-
|
21
|
-
|
22
|
-
class ApplicationTypeTest < Minitest::Test
|
23
|
-
def do_test(input, expected)
|
24
|
-
output = Authlete::Types::ApplicationType::constant_get(input)
|
25
|
-
|
26
|
-
if expected.nil?
|
27
|
-
assert_nil output
|
28
|
-
else
|
29
|
-
assert_equal expected, output
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_unknown
|
34
|
-
do_test('UNKNOWN', nil)
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_web
|
38
|
-
do_test('WEB', 'web')
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_native
|
42
|
-
do_test('NATIVE', 'native')
|
43
|
-
end
|
44
|
-
end
|
@@ -1,64 +0,0 @@
|
|
1
|
-
# :nodoc:
|
2
|
-
#
|
3
|
-
# Copyright (C) 2022 Authlete, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
|
18
|
-
require 'authlete'
|
19
|
-
require 'minitest/autorun'
|
20
|
-
|
21
|
-
|
22
|
-
class ClientAuthMethodTest < Minitest::Test
|
23
|
-
def do_test(input, expected)
|
24
|
-
output = Authlete::Types::ClientAuthMethod::constant_get(input)
|
25
|
-
|
26
|
-
if expected.nil?
|
27
|
-
assert_nil output
|
28
|
-
else
|
29
|
-
assert_equal expected, output
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_unknown
|
34
|
-
do_test('UNKNOWN', nil)
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_none
|
38
|
-
do_test('NONE', 'none')
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_client_secret_basic
|
42
|
-
do_test('CLIENT_SECRET_BASIC', 'client_secret_basic')
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_client_secret_post
|
46
|
-
do_test('CLIENT_SECRET_POST', 'client_secret_post')
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_client_secret_jwt
|
50
|
-
do_test('CLIENT_SECRET_JWT', 'client_secret_jwt')
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_private_key_jwt
|
54
|
-
do_test('PRIVATE_KEY_JWT', 'private_key_jwt')
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_tls_client_auth
|
58
|
-
do_test('TLS_CLIENT_AUTH', 'tls_client_auth')
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_self_signed_tls_client_auth
|
62
|
-
do_test('SELF_SIGNED_TLS_CLIENT_AUTH', 'self_signed_tls_client_auth')
|
63
|
-
end
|
64
|
-
end
|
@@ -1,48 +0,0 @@
|
|
1
|
-
# :nodoc:
|
2
|
-
#
|
3
|
-
# Copyright (C) 2022 Authlete, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
|
18
|
-
require 'authlete'
|
19
|
-
require 'minitest/autorun'
|
20
|
-
|
21
|
-
|
22
|
-
class DeliveryModeTest < Minitest::Test
|
23
|
-
def do_test(input, expected)
|
24
|
-
output = Authlete::Types::DeliveryMode::constant_get(input)
|
25
|
-
|
26
|
-
if expected.nil?
|
27
|
-
assert_nil output
|
28
|
-
else
|
29
|
-
assert_equal expected, output
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_unknown
|
34
|
-
do_test('UNKNOWN', nil)
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_poll
|
38
|
-
do_test('POLL', 'poll')
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_ping
|
42
|
-
do_test('PING', 'ping')
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_push
|
46
|
-
do_test('PUSH', 'push')
|
47
|
-
end
|
48
|
-
end
|
@@ -1,72 +0,0 @@
|
|
1
|
-
# :nodoc:
|
2
|
-
#
|
3
|
-
# Copyright (C) 2022 Authlete, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
|
18
|
-
require 'authlete'
|
19
|
-
require 'minitest/autorun'
|
20
|
-
|
21
|
-
|
22
|
-
class GrantTypeTest < Minitest::Test
|
23
|
-
def do_test(input, expected)
|
24
|
-
output = Authlete::Types::GrantType::constant_get(input)
|
25
|
-
|
26
|
-
if expected.nil?
|
27
|
-
assert_nil output
|
28
|
-
else
|
29
|
-
assert_equal expected, output
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_unknown
|
34
|
-
do_test('UNKNOWN', nil)
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_authorization_code
|
38
|
-
do_test('AUTHORIZATION_CODE', 'authorization_code')
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_implicit
|
42
|
-
do_test('IMPLICIT', 'implicit')
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_password
|
46
|
-
do_test('PASSWORD', 'password')
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_client_credentials
|
50
|
-
do_test('CLIENT_CREDENTIALS', 'client_credentials')
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_refresh_token
|
54
|
-
do_test('REFRESH_TOKEN', 'refresh_token')
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_ciba
|
58
|
-
do_test('CIBA', 'urn:openid:params:grant-type:ciba')
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_device_code
|
62
|
-
do_test('DEVICE_CODE', 'urn:ietf:params:oauth:grant-type:device_code')
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_token_exchange
|
66
|
-
do_test('TOKEN_EXCHANGE', 'urn:ietf:params:oauth:grant-type:token-exchange')
|
67
|
-
end
|
68
|
-
|
69
|
-
def test_jwt_bearer
|
70
|
-
do_test('JWT_BEARER', 'urn:ietf:params:oauth:grant-type:jwt-bearer')
|
71
|
-
end
|
72
|
-
end
|
@@ -1,104 +0,0 @@
|
|
1
|
-
# :nodoc:
|
2
|
-
#
|
3
|
-
# Copyright (C) 2022 Authlete, Inc.
|
4
|
-
#
|
5
|
-
# Licensed under the Apache License, Version 2.0 (the "License");
|
6
|
-
# you may not use this file except in compliance with the License.
|
7
|
-
# You may obtain a copy of the License at
|
8
|
-
#
|
9
|
-
# http://www.apache.org/licenses/LICENSE-2.0
|
10
|
-
#
|
11
|
-
# Unless required by applicable law or agreed to in writing, software
|
12
|
-
# distributed under the License is distributed on an "AS IS" BASIS,
|
13
|
-
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
14
|
-
# See the License for the specific language governing permissions and
|
15
|
-
# limitations under the License.
|
16
|
-
|
17
|
-
|
18
|
-
require 'authlete'
|
19
|
-
require 'minitest/autorun'
|
20
|
-
|
21
|
-
|
22
|
-
class JWEAlgTest < Minitest::Test
|
23
|
-
def do_test(input, expected)
|
24
|
-
output = Authlete::Types::JWEAlg::constant_get(input)
|
25
|
-
|
26
|
-
if expected.nil?
|
27
|
-
assert_nil output
|
28
|
-
else
|
29
|
-
assert_equal expected, output
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def test_unknown
|
34
|
-
do_test('UNKNOWN', nil)
|
35
|
-
end
|
36
|
-
|
37
|
-
def test_rsa1_5
|
38
|
-
do_test('RSA1_5', 'RSA1_5')
|
39
|
-
end
|
40
|
-
|
41
|
-
def test_oaep
|
42
|
-
do_test('RSA_OAEP', 'RSA-OAEP')
|
43
|
-
end
|
44
|
-
|
45
|
-
def test_oaep_256
|
46
|
-
do_test('RSA_OAEP_256', 'RSA-OAEP-256')
|
47
|
-
end
|
48
|
-
|
49
|
-
def test_a128kw
|
50
|
-
do_test('A128KW', 'A128KW')
|
51
|
-
end
|
52
|
-
|
53
|
-
def test_a192kw
|
54
|
-
do_test('A192KW', 'A192KW')
|
55
|
-
end
|
56
|
-
|
57
|
-
def test_a256kw
|
58
|
-
do_test('A256KW', 'A256KW')
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_dir
|
62
|
-
do_test('DIR', 'dir')
|
63
|
-
end
|
64
|
-
|
65
|
-
def test_ecdh_es
|
66
|
-
do_test('ECDH_ES', 'ECDH-ES')
|
67
|
-
end
|
68
|
-
|
69
|
-
def test_ecdh_es_a128kw
|
70
|
-
do_test('ECDH_ES_A128KW', 'ECDH-ES+A128KW')
|
71
|
-
end
|
72
|
-
|
73
|
-
def test_ecdh_es_a192kw
|
74
|
-
do_test('ECDH_ES_A192KW', 'ECDH-ES+A192KW')
|
75
|
-
end
|
76
|
-
|
77
|
-
def test_ecdh_es_a256kw
|
78
|
-
do_test('ECDH_ES_A256KW', 'ECDH-ES+A256KW')
|
79
|
-
end
|
80
|
-
|
81
|
-
def test_a128gcmkw
|
82
|
-
do_test('A128GCMKW', 'A128GCMKW')
|
83
|
-
end
|
84
|
-
|
85
|
-
def test_a192gcmkw
|
86
|
-
do_test('A192GCMKW', 'A192GCMKW')
|
87
|
-
end
|
88
|
-
|
89
|
-
def test_a256gcmkw
|
90
|
-
do_test('A256GCMKW', 'A256GCMKW')
|
91
|
-
end
|
92
|
-
|
93
|
-
def test_pbes2_hs256_a128kw
|
94
|
-
do_test('PBES2_HS256_A128KW', 'PBES2-HS256+A128KW')
|
95
|
-
end
|
96
|
-
|
97
|
-
def test_pbes2_hs384_a192kw
|
98
|
-
do_test('PBES2_HS384_A192KW', 'PBES2-HS384+A192KW')
|
99
|
-
end
|
100
|
-
|
101
|
-
def test_pbes2_hs512_a256kw
|
102
|
-
do_test('PBES2_HS512_A256KW', 'PBES2-HS512+A256KW')
|
103
|
-
end
|
104
|
-
end
|