authlete 1.7.0 → 1.11.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 97d78dd039d8f22081dd1085109d84809e5ee772
4
- data.tar.gz: 7b3569794b98ad7c59eb28d0e458d4d05be474c6
2
+ SHA256:
3
+ metadata.gz: 577aec2ce8765b18c221169cbee8c7daa6b6c4e48bfffc665cbb819325373318
4
+ data.tar.gz: d01b7ababf92b96a193d59a28bae1a8d98a5170e01f047288ab766ce8909388e
5
5
  SHA512:
6
- metadata.gz: b737891b85b5507471f8ffe9ababe62ca7b2134b1b31a0e08c97ab8c36d862e296bc78649e2fc95768c2ce93895ca8dab189d74c0c13c609075268d89de9d27a
7
- data.tar.gz: 3b1c04aba0b8e84bf1d0306ca93f0a9e93b0841442deba6d5e170c5cca75b9d8694338a91906671e44a37d97c9913f59d4f253f4e3b7486d1e6047d29a3f71a5
6
+ metadata.gz: fc4b13c802eefd16f51b5dd5af62bde5671fd8e49509ea0755641106847041d85675ec13290c40f1ab15d160829ec467b72beebfe3cabe598c07cf653a8e109b
7
+ data.tar.gz: e02ac5ffa5c47d88d7bc3b5ab6368696268a122a9ca1ab828f89b1d8f6efcee10a66690452e37eb35ddb2c780cc56ca09658a473624a22f4e4fe95ae50d0bfe3
data/authlete.gemspec CHANGED
@@ -20,6 +20,6 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_runtime_dependency "rest-client", ">= 1.7.2"
22
22
 
23
- spec.add_development_dependency "bundler", "~> 1.7"
24
- spec.add_development_dependency "rake", "~> 10.0"
23
+ spec.add_development_dependency "bundler", ">= 2.2.10"
24
+ spec.add_development_dependency "rake", ">= 12.3.3"
25
25
  end
@@ -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,27 @@ 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
+
466
+ attr_accessor :refreshTokenDurationReset
467
+ alias_method :refresh_token_duration_reset, :refreshTokenDurationReset
468
+ alias_method :refresh_token_duration_reset=, :refreshTokenDurationReset=
469
+
470
+ attr_accessor :grantManagementEndpoint
471
+ alias_method :grant_management_endpoint, :grantManagementEndpoint
472
+ alias_method :grant_management_endpoint=, :grantManagementEndpoint=
473
+
474
+ attr_accessor :grantManagementActionRequired
475
+ alias_method :grant_management_action_required, :grantManagementActionRequired
476
+ alias_method :grant_management_action_required=, :grantManagementActionRequired=
477
+
478
+ attr_accessor :unauthorizedOnClientConfigSupported
479
+ alias_method :unauthorized_on_client_config_supported, :unauthorizedOnClientConfigSupported
480
+ alias_method :unauthorized_on_client_config_supported=, :unauthorizedOnClientConfigSupported=
460
481
  private
461
482
 
462
483
  def defaults
@@ -572,7 +593,13 @@ module Authlete
572
593
  tokenExpirationLinked: false,
573
594
  frontChannelRequestObjectEncryptionRequired: false,
574
595
  requestObjectEncryptionAlgMatchRequired: false,
575
- requestObjectEncryptionEncMatchRequired: false
596
+ requestObjectEncryptionEncMatchRequired: false,
597
+ hsks: nil,
598
+ hsmEnabled: false,
599
+ refreshTokenDurationReset: false,
600
+ grantManagementEndpoint: nil,
601
+ grantManagementActionRequired: false,
602
+ unauthorizedOnClientConfigSupported: false
576
603
  }
577
604
  end
578
605
 
@@ -689,6 +716,12 @@ module Authlete
689
716
  @frontChannelRequestObjectEncryptionRequired = hash[:frontChannelRequestObjectEncryptionRequired]
690
717
  @requestObjectEncryptionAlgMatchRequired = hash[:requestObjectEncryptionAlgMatchRequired]
691
718
  @requestObjectEncryptionEncMatchRequired = hash[:requestObjectEncryptionEncMatchRequired]
719
+ @hsks = get_parsed_array(hash[:hsks]) { |e| Authlete::Model::Hsk.parse(e) }
720
+ @hsmEnabled = hash[:hsmEnabled]
721
+ @refreshTokenDurationReset = hash[:refreshTokenDurationReset]
722
+ @grantManagementEndpoint = hash[:grantManagementEndpoint]
723
+ @grantManagementActionRequired = hash[:grantManagementActionRequired]
724
+ @unauthorizedOnClientConfigSupported = hash[:unauthorizedOnClientConfigSupported]
692
725
  end
693
726
 
694
727
  def to_hash_value(key, var)
@@ -696,7 +729,7 @@ module Authlete
696
729
 
697
730
  case key
698
731
  when :snsCredentials, :developerSnsCredentials, :supportedScopes,
699
- :metadata, :mtlsEndpointAliases, :attributes
732
+ :metadata, :mtlsEndpointAliases, :attributes, :hsks
700
733
  raw_val&.map { |e| e.to_hash }
701
734
  else
702
735
  raw_val
@@ -16,5 +16,5 @@
16
16
 
17
17
 
18
18
  module Authlete
19
- VERSION = "1.7.0"
19
+ VERSION = "1.11.0"
20
20
  end
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,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,7 +147,19 @@ 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
-
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
159
+ REFRESH_TOKEN_DURATION_RESET = false
160
+ GRANT_MANAGEMENT_ENDPOINT = '<grant-management-endpoint>'
161
+ GRANT_MANAGEMENT_ACTION_REQUIRED = false
162
+ UNATHORIZED_ON_CLIENT_CONFIG_SUPPORTED = false
151
163
 
152
164
  def generate_json
153
165
  return <<~JSON
@@ -165,6 +177,8 @@ class ServiceTest < Minitest::Test
165
177
  "userInfoEndpoint": "<user-info-endpoint>",
166
178
  "jwksUri": "<jwks-uri>",
167
179
  "jwks": "<jwks>",
180
+ "hsks": [ { "kty": "EC", "use": "sig", "alg": "ES256", "kid": "jane", "hsmName": "google", "handle": "<handle>", "publicKey": "<public-key>" } ],
181
+ "hsmEnabled": false,
168
182
  "registrationEndpoint": "<registration-endpoint>",
169
183
  "registrationManagementEndpoint": "<registration-management-endpoint>",
170
184
  "supportedScopes": [ { "name": "scope0", "description": "<scope0-description>" } ],
@@ -263,7 +277,11 @@ class ServiceTest < Minitest::Test
263
277
  "tokenExpirationLinked": false,
264
278
  "frontChannelRequestObjectEncryptionRequired": false,
265
279
  "requestObjectEncryptionAlgMatchRequired": false,
266
- "requestObjectEncryptionEncMatchRequired": false
280
+ "requestObjectEncryptionEncMatchRequired": false,
281
+ "refreshTokenDurationReset": false,
282
+ "grantManagementEndpoint": "<grant-management-endpoint>",
283
+ "grantManagementActionRequired": false,
284
+ "unauthorizedOnClientConfigSupported": false
267
285
  }
268
286
  JSON
269
287
  end
@@ -382,7 +400,13 @@ class ServiceTest < Minitest::Test
382
400
  tokenExpirationLinked: false,
383
401
  frontChannelRequestObjectEncryptionRequired: false,
384
402
  requestObjectEncryptionAlgMatchRequired: false,
385
- requestObjectEncryptionEncMatchRequired: false
403
+ requestObjectEncryptionEncMatchRequired: false,
404
+ hsks: [ { kty: 'EC', use: 'sig', alg: 'ES256', kid: 'jane', hsmName: 'google', handle: '<handle>', publicKey: '<public-key>' } ],
405
+ hsmEnabled: false,
406
+ refreshTokenDurationReset: false,
407
+ grantManagementEndpoint: '<grant-management-endpoint>',
408
+ grantManagementActionRequired: false,
409
+ unauthorizedOnClientConfigSupported: false
386
410
  }
387
411
  end
388
412
 
@@ -500,6 +524,12 @@ class ServiceTest < Minitest::Test
500
524
  obj.frontChannelRequestObjectEncryptionRequired = FRONT_CHANNEL_REQUEST_OBJECT_ENCRYPTION_REQUIRED
501
525
  obj.requestObjectEncryptionAlgMatchRequired = REQUEST_OBJECT_ENCRYPTION_ALG_MATCH_REQUIRED
502
526
  obj.requestObjectEncryptionEncMatchRequired = REQUEST_OBJECT_ENCRYPTION_ENC_MATCH_REQUIRED
527
+ obj.hsks = HSKS
528
+ obj.hsm_enabled = HSM_ENABLED
529
+ obj.refresh_token_duration_reset = REFRESH_TOKEN_DURATION_RESET
530
+ obj.grant_management_endpoint = GRANT_MANAGEMENT_ENDPOINT
531
+ obj.grant_management_action_required = GRANT_MANAGEMENT_ACTION_REQUIRED
532
+ obj.unauthorized_on_client_config_supported = UNATHORIZED_ON_CLIENT_CONFIG_SUPPORTED
503
533
  end
504
534
 
505
535
 
@@ -624,6 +654,18 @@ class ServiceTest < Minitest::Test
624
654
  assert_equal FRONT_CHANNEL_REQUEST_OBJECT_ENCRYPTION_REQUIRED, obj.frontChannelRequestObjectEncryptionRequired
625
655
  assert_equal REQUEST_OBJECT_ENCRYPTION_ALG_MATCH_REQUIRED, obj.requestObjectEncryptionAlgMatchRequired
626
656
  assert_equal REQUEST_OBJECT_ENCRYPTION_ENC_MATCH_REQUIRED, obj.requestObjectEncryptionEncMatchRequired
657
+ assert_equal HSKS_KTY, obj.hsks[0].kty
658
+ assert_equal HSKS_USE, obj.hsks[0].use
659
+ assert_equal HSKS_ALG, obj.hsks[0].alg
660
+ assert_equal HSKS_KID, obj.hsks[0].kid
661
+ assert_equal HSKS_HSMNAME, obj.hsks[0].hsmName
662
+ assert_equal HSKS_HANDLE, obj.hsks[0].handle
663
+ assert_equal HSKS_PUBLICKEY, obj.hsks[0].publicKey
664
+ assert_equal HSM_ENABLED, obj.hsmEnabled
665
+ assert_equal REFRESH_TOKEN_DURATION_RESET, obj.refreshTokenDurationReset
666
+ assert_equal GRANT_MANAGEMENT_ENDPOINT, obj.grantManagementEndpoint
667
+ assert_equal GRANT_MANAGEMENT_ACTION_REQUIRED, obj.grantManagementActionRequired
668
+ assert_equal UNATHORIZED_ON_CLIENT_CONFIG_SUPPORTED, obj.unauthorizedOnClientConfigSupported
627
669
  end
628
670
 
629
671
 
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.7.0
4
+ version: 1.11.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-06-26 00:00:00.000000000 Z
12
+ date: 2021-10-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -29,30 +29,30 @@ dependencies:
29
29
  name: bundler
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - "~>"
32
+ - - ">="
33
33
  - !ruby/object:Gem::Version
34
- version: '1.7'
34
+ version: 2.2.10
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - "~>"
39
+ - - ">="
40
40
  - !ruby/object:Gem::Version
41
- version: '1.7'
41
+ version: 2.2.10
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rake
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - "~>"
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
- version: '10.0'
48
+ version: 12.3.3
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - "~>"
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
- version: '10.0'
55
+ version: 12.3.3
56
56
  description: A library for Authlete Web APIs. See https://docs.authlete.com/ for details.
57
57
  email:
58
58
  - admin@authlete.com
@@ -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
- rubyforge_project:
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