authlete 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/lib/authlete.rb +1 -0
- data/lib/authlete/model/hsk.rb +67 -0
- data/lib/authlete/model/service.rb +12 -2
- data/lib/authlete/version.rb +1 -1
- data/test/authlete/model/test_hsk.rb +108 -0
- data/test/authlete/model/test_service.rb +24 -1
- metadata +6 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 164290174c960b47c0108dbde641e0c01e37f38b2bdbafa9f36fcbb68f5dd053
|
|
4
|
+
data.tar.gz: 625eba82bcdee17d39a2635199e6228e6e9a001729fdf64a1343c486ecd23998
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9a5224c845954deb1f327f7c726c5c61368800563225abe58190208bbd18a158764d656dff2576816faf1ef13772153004beb77dbd7555b9a587c6ddeb2df74a
|
|
7
|
+
data.tar.gz: 6a51b9016c348e583f1d5b43285c021aea1e60d6d3371a059d997f12e731cedc70dca2d5bdf883657c815d609fd3ea5ed293ddecbafb67f20a39d9dfb04ccd4b
|
data/lib/authlete.rb
CHANGED
|
@@ -39,6 +39,7 @@ module Authlete
|
|
|
39
39
|
autoload :SnsCredentials, 'authlete/model/sns-credentials'
|
|
40
40
|
autoload :TaggedValue, 'authlete/model/tagged-value'
|
|
41
41
|
autoload :NamedUri, 'authlete/model/named-uri'
|
|
42
|
+
autoload :Hsk, 'authlete/model/hsk'
|
|
42
43
|
|
|
43
44
|
module Request
|
|
44
45
|
autoload :AuthenticationCallbackRequest, 'authlete/model/request/authentication-callback-request'
|
|
@@ -0,0 +1,67 @@
|
|
|
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
|
+
module Authlete
|
|
19
|
+
module Model
|
|
20
|
+
class Hsk < Authlete::Model::Base
|
|
21
|
+
include Authlete::Model::Hashable
|
|
22
|
+
include Authlete::Utility
|
|
23
|
+
|
|
24
|
+
attr_accessor :kty
|
|
25
|
+
|
|
26
|
+
attr_accessor :use
|
|
27
|
+
|
|
28
|
+
attr_accessor :alg
|
|
29
|
+
|
|
30
|
+
attr_accessor :kid
|
|
31
|
+
|
|
32
|
+
attr_accessor :hsmName
|
|
33
|
+
alias_method :hsm_name, :hsmName
|
|
34
|
+
alias_method :hsm_name=, :hsmName=
|
|
35
|
+
|
|
36
|
+
attr_accessor :handle
|
|
37
|
+
|
|
38
|
+
attr_accessor :publicKey
|
|
39
|
+
alias_method :public_key, :publicKey
|
|
40
|
+
alias_method :public_key=, :publicKey=
|
|
41
|
+
|
|
42
|
+
private
|
|
43
|
+
|
|
44
|
+
def defaults
|
|
45
|
+
{
|
|
46
|
+
kty: nil,
|
|
47
|
+
use: nil,
|
|
48
|
+
alg: nil,
|
|
49
|
+
kid: nil,
|
|
50
|
+
hsmName: nil,
|
|
51
|
+
handle: nil,
|
|
52
|
+
publicKey: nil,
|
|
53
|
+
}
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def set_params(hash)
|
|
57
|
+
@kty = hash[:kty]
|
|
58
|
+
@use = hash[:use]
|
|
59
|
+
@alg = hash[:alg]
|
|
60
|
+
@kid = hash[:kid]
|
|
61
|
+
@hsmName = hash[:hsmName]
|
|
62
|
+
@handle = hash[:handle]
|
|
63
|
+
@publicKey = hash[:publicKey]
|
|
64
|
+
end
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
|
@@ -457,6 +457,12 @@ module Authlete
|
|
|
457
457
|
alias_method :request_object_encryption_enc_match_required, :requestObjectEncryptionEncMatchRequired
|
|
458
458
|
alias_method :request_object_encryption_enc_match_required=, :requestObjectEncryptionEncMatchRequired=
|
|
459
459
|
|
|
460
|
+
attr_accessor :hsks
|
|
461
|
+
|
|
462
|
+
attr_accessor :hsmEnabled
|
|
463
|
+
alias_method :hsm_enabled, :hsmEnabled
|
|
464
|
+
alias_method :hsm_enabled=, :hsmEnabled=
|
|
465
|
+
|
|
460
466
|
private
|
|
461
467
|
|
|
462
468
|
def defaults
|
|
@@ -572,7 +578,9 @@ module Authlete
|
|
|
572
578
|
tokenExpirationLinked: false,
|
|
573
579
|
frontChannelRequestObjectEncryptionRequired: false,
|
|
574
580
|
requestObjectEncryptionAlgMatchRequired: false,
|
|
575
|
-
requestObjectEncryptionEncMatchRequired: false
|
|
581
|
+
requestObjectEncryptionEncMatchRequired: false,
|
|
582
|
+
hsks: nil,
|
|
583
|
+
hsmEnabled: false
|
|
576
584
|
}
|
|
577
585
|
end
|
|
578
586
|
|
|
@@ -689,6 +697,8 @@ module Authlete
|
|
|
689
697
|
@frontChannelRequestObjectEncryptionRequired = hash[:frontChannelRequestObjectEncryptionRequired]
|
|
690
698
|
@requestObjectEncryptionAlgMatchRequired = hash[:requestObjectEncryptionAlgMatchRequired]
|
|
691
699
|
@requestObjectEncryptionEncMatchRequired = hash[:requestObjectEncryptionEncMatchRequired]
|
|
700
|
+
@hsks = get_parsed_array(hash[:hsks]) { |e| Authlete::Model::Hsk.parse(e) }
|
|
701
|
+
@hsmEnabled = hash[:hsmEnabled]
|
|
692
702
|
end
|
|
693
703
|
|
|
694
704
|
def to_hash_value(key, var)
|
|
@@ -696,7 +706,7 @@ module Authlete
|
|
|
696
706
|
|
|
697
707
|
case key
|
|
698
708
|
when :snsCredentials, :developerSnsCredentials, :supportedScopes,
|
|
699
|
-
:metadata, :mtlsEndpointAliases, :attributes
|
|
709
|
+
:metadata, :mtlsEndpointAliases, :attributes, :hsks
|
|
700
710
|
raw_val&.map { |e| e.to_hash }
|
|
701
711
|
else
|
|
702
712
|
raw_val
|
data/lib/authlete/version.rb
CHANGED
|
@@ -0,0 +1,108 @@
|
|
|
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 HskTest < Minitest::Test
|
|
24
|
+
KTY = 'EC'
|
|
25
|
+
USE = 'sig'
|
|
26
|
+
ALG = 'ES256'
|
|
27
|
+
KID = 'jane'
|
|
28
|
+
HSM_NAME = 'google'
|
|
29
|
+
HANDLE = '<handle>'
|
|
30
|
+
PUBLIC_KEY = '<public-key>'
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def generate_json
|
|
34
|
+
return <<~JSON
|
|
35
|
+
{
|
|
36
|
+
"kty": "EC",
|
|
37
|
+
"use": "sig",
|
|
38
|
+
"alg": "ES256",
|
|
39
|
+
"kid": "jane",
|
|
40
|
+
"hsmName": "google",
|
|
41
|
+
"handle": "<handle>",
|
|
42
|
+
"publicKey": "<public-key>"
|
|
43
|
+
}
|
|
44
|
+
JSON
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def generate_hash
|
|
49
|
+
{
|
|
50
|
+
kty: 'EC',
|
|
51
|
+
use: 'sig',
|
|
52
|
+
alg: 'ES256',
|
|
53
|
+
kid: 'jane',
|
|
54
|
+
hsmName: 'google',
|
|
55
|
+
handle: '<handle>',
|
|
56
|
+
publicKey: '<public-key>'
|
|
57
|
+
}
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def set_params(obj)
|
|
62
|
+
obj.kty = KTY
|
|
63
|
+
obj.use = USE
|
|
64
|
+
obj.alg = ALG
|
|
65
|
+
obj.kid = KID
|
|
66
|
+
obj.hsmName = HSM_NAME
|
|
67
|
+
obj.handle = HANDLE
|
|
68
|
+
obj.publicKey = PUBLIC_KEY
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def match(obj)
|
|
73
|
+
assert_equal KTY, obj.kty
|
|
74
|
+
assert_equal USE, obj.use
|
|
75
|
+
assert_equal ALG, obj.alg
|
|
76
|
+
assert_equal KID, obj.kid
|
|
77
|
+
assert_equal HSM_NAME, obj.hsmName
|
|
78
|
+
assert_equal HANDLE, obj.handle
|
|
79
|
+
assert_equal PUBLIC_KEY, obj.publicKey
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
def test_from_json
|
|
84
|
+
jsn = generate_json
|
|
85
|
+
hsh = JSON.parse(jsn)
|
|
86
|
+
actual = Authlete::Model::Hsk.new(hsh)
|
|
87
|
+
|
|
88
|
+
match(actual)
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def test_setters
|
|
93
|
+
actual = Authlete::Model::Hsk.new
|
|
94
|
+
set_params(actual)
|
|
95
|
+
|
|
96
|
+
match(actual)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def test_to_hash
|
|
101
|
+
obj = Authlete::Model::Hsk.new
|
|
102
|
+
set_params(obj)
|
|
103
|
+
actual = obj.to_hash
|
|
104
|
+
expected = generate_hash
|
|
105
|
+
|
|
106
|
+
assert_equal expected, actual
|
|
107
|
+
end
|
|
108
|
+
end
|
|
@@ -147,6 +147,15 @@ class ServiceTest < Minitest::Test
|
|
|
147
147
|
FRONT_CHANNEL_REQUEST_OBJECT_ENCRYPTION_REQUIRED = false
|
|
148
148
|
REQUEST_OBJECT_ENCRYPTION_ALG_MATCH_REQUIRED = false
|
|
149
149
|
REQUEST_OBJECT_ENCRYPTION_ENC_MATCH_REQUIRED = false
|
|
150
|
+
HSKS_KTY = 'EC'
|
|
151
|
+
HSKS_USE = 'sig'
|
|
152
|
+
HSKS_ALG = 'ES256'
|
|
153
|
+
HSKS_KID = 'jane'
|
|
154
|
+
HSKS_HSMNAME = 'google'
|
|
155
|
+
HSKS_HANDLE = '<handle>'
|
|
156
|
+
HSKS_PUBLICKEY = '<public-key>'
|
|
157
|
+
HSKS = [ Authlete::Model::Hsk.new(kty: HSKS_KTY, use: HSKS_USE, alg: HSKS_ALG, kid: HSKS_KID, hsmName: HSKS_HSMNAME, handle: HSKS_HANDLE, publicKey: HSKS_PUBLICKEY) ]
|
|
158
|
+
HSM_ENABLED = false
|
|
150
159
|
|
|
151
160
|
|
|
152
161
|
def generate_json
|
|
@@ -165,6 +174,8 @@ class ServiceTest < Minitest::Test
|
|
|
165
174
|
"userInfoEndpoint": "<user-info-endpoint>",
|
|
166
175
|
"jwksUri": "<jwks-uri>",
|
|
167
176
|
"jwks": "<jwks>",
|
|
177
|
+
"hsks": [ { "kty": "EC", "use": "sig", "alg": "ES256", "kid": "jane", "hsmName": "google", "handle": "<handle>", "publicKey": "<public-key>" } ],
|
|
178
|
+
"hsmEnabled": false,
|
|
168
179
|
"registrationEndpoint": "<registration-endpoint>",
|
|
169
180
|
"registrationManagementEndpoint": "<registration-management-endpoint>",
|
|
170
181
|
"supportedScopes": [ { "name": "scope0", "description": "<scope0-description>" } ],
|
|
@@ -382,7 +393,9 @@ class ServiceTest < Minitest::Test
|
|
|
382
393
|
tokenExpirationLinked: false,
|
|
383
394
|
frontChannelRequestObjectEncryptionRequired: false,
|
|
384
395
|
requestObjectEncryptionAlgMatchRequired: false,
|
|
385
|
-
requestObjectEncryptionEncMatchRequired: false
|
|
396
|
+
requestObjectEncryptionEncMatchRequired: false,
|
|
397
|
+
hsks: [ { kty: 'EC', use: 'sig', alg: 'ES256', kid: 'jane', hsmName: 'google', handle: '<handle>', publicKey: '<public-key>' } ],
|
|
398
|
+
hsmEnabled: false
|
|
386
399
|
}
|
|
387
400
|
end
|
|
388
401
|
|
|
@@ -500,6 +513,8 @@ class ServiceTest < Minitest::Test
|
|
|
500
513
|
obj.frontChannelRequestObjectEncryptionRequired = FRONT_CHANNEL_REQUEST_OBJECT_ENCRYPTION_REQUIRED
|
|
501
514
|
obj.requestObjectEncryptionAlgMatchRequired = REQUEST_OBJECT_ENCRYPTION_ALG_MATCH_REQUIRED
|
|
502
515
|
obj.requestObjectEncryptionEncMatchRequired = REQUEST_OBJECT_ENCRYPTION_ENC_MATCH_REQUIRED
|
|
516
|
+
obj.hsks = HSKS
|
|
517
|
+
obj.hsm_enabled = HSM_ENABLED
|
|
503
518
|
end
|
|
504
519
|
|
|
505
520
|
|
|
@@ -624,6 +639,14 @@ class ServiceTest < Minitest::Test
|
|
|
624
639
|
assert_equal FRONT_CHANNEL_REQUEST_OBJECT_ENCRYPTION_REQUIRED, obj.frontChannelRequestObjectEncryptionRequired
|
|
625
640
|
assert_equal REQUEST_OBJECT_ENCRYPTION_ALG_MATCH_REQUIRED, obj.requestObjectEncryptionAlgMatchRequired
|
|
626
641
|
assert_equal REQUEST_OBJECT_ENCRYPTION_ENC_MATCH_REQUIRED, obj.requestObjectEncryptionEncMatchRequired
|
|
642
|
+
assert_equal HSKS_KTY, obj.hsks[0].kty
|
|
643
|
+
assert_equal HSKS_USE, obj.hsks[0].use
|
|
644
|
+
assert_equal HSKS_ALG, obj.hsks[0].alg
|
|
645
|
+
assert_equal HSKS_KID, obj.hsks[0].kid
|
|
646
|
+
assert_equal HSKS_HSMNAME, obj.hsks[0].hsmName
|
|
647
|
+
assert_equal HSKS_HANDLE, obj.hsks[0].handle
|
|
648
|
+
assert_equal HSKS_PUBLICKEY, obj.hsks[0].publicKey
|
|
649
|
+
assert_equal HSM_ENABLED, obj.hsmEnabled
|
|
627
650
|
end
|
|
628
651
|
|
|
629
652
|
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: authlete
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.
|
|
4
|
+
version: 1.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Takahiko Kawasaki
|
|
@@ -9,7 +9,7 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date: 2021-
|
|
12
|
+
date: 2021-07-08 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: rest-client
|
|
@@ -75,6 +75,7 @@ files:
|
|
|
75
75
|
- lib/authlete/model/client-extension.rb
|
|
76
76
|
- lib/authlete/model/client.rb
|
|
77
77
|
- lib/authlete/model/hashable.rb
|
|
78
|
+
- lib/authlete/model/hsk.rb
|
|
78
79
|
- lib/authlete/model/named-uri.rb
|
|
79
80
|
- lib/authlete/model/pair.rb
|
|
80
81
|
- lib/authlete/model/param-initializer.rb
|
|
@@ -207,6 +208,7 @@ files:
|
|
|
207
208
|
- test/authlete/model/response/test_user-info-response.rb
|
|
208
209
|
- test/authlete/model/test_client-extension.rb
|
|
209
210
|
- test/authlete/model/test_client.rb
|
|
211
|
+
- test/authlete/model/test_hsk.rb
|
|
210
212
|
- test/authlete/model/test_named-uri.rb
|
|
211
213
|
- test/authlete/model/test_pair.rb
|
|
212
214
|
- test/authlete/model/test_property.rb
|
|
@@ -236,8 +238,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
236
238
|
- !ruby/object:Gem::Version
|
|
237
239
|
version: '0'
|
|
238
240
|
requirements: []
|
|
239
|
-
|
|
240
|
-
rubygems_version: 2.6.8
|
|
241
|
+
rubygems_version: 3.2.15
|
|
241
242
|
signing_key:
|
|
242
243
|
specification_version: 4
|
|
243
244
|
summary: A library for Authlete Web APIs
|
|
@@ -300,6 +301,7 @@ test_files:
|
|
|
300
301
|
- test/authlete/model/response/test_user-info-response.rb
|
|
301
302
|
- test/authlete/model/test_client-extension.rb
|
|
302
303
|
- test/authlete/model/test_client.rb
|
|
304
|
+
- test/authlete/model/test_hsk.rb
|
|
303
305
|
- test/authlete/model/test_named-uri.rb
|
|
304
306
|
- test/authlete/model/test_pair.rb
|
|
305
307
|
- test/authlete/model/test_property.rb
|