authlete 1.0.21 → 1.0.22

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.
@@ -371,6 +371,12 @@ module Authlete
371
371
  alias_method :authorization_data_types, :authorizationDataTypes
372
372
  alias_method :authorization_data_types=, :authorizationDataTypes=
373
373
 
374
+ # Flag of whether this client is required to use the pushed authorization
375
+ # request endpoint. (Boolean)
376
+ attr_accessor :parRequired
377
+ alias_method :par_required, :parRequired
378
+ alias_method :par_required=, :parRequired=
379
+
374
380
  private
375
381
 
376
382
  # Integer attributes.
@@ -381,7 +387,7 @@ module Authlete
381
387
  # Boolean attributes.
382
388
  BOOLEAN_ATTRIBUTES = ::Set.new([
383
389
  :authTimeRequired, :clientIdAliasEnabled, :tlsClientCertificateBoundAccessTokens,
384
- :bcUserCodeRequired, :dynamicallyRegistered
390
+ :bcUserCodeRequired, :dynamicallyRegistered, :parRequired
385
391
  ])
386
392
 
387
393
  # String attributes.
@@ -411,64 +417,65 @@ module Authlete
411
417
 
412
418
  # Mapping from snake cases to camel cases.
413
419
  SNAKE_TO_CAMEL = {
414
- :service_number => :serviceNumber,
415
- :client_id => :clientId,
416
- :client_id_alias => :clientIdAlias,
417
- :client_id_alias_enabled => :clientIdAliasEnabled,
418
- :client_secret => :clientSecret,
419
- :client_type => :clientType,
420
- :redirect_uris => :redirectUris,
421
- :response_types => :responseTypes,
422
- :grant_types => :grantTypes,
423
- :application_type => :applicationType,
424
- :client_name => :clientName,
425
- :client_names => :clientNames,
426
- :logo_uri => :logoUri,
427
- :logo_uris => :logoUris,
428
- :client_uri => :clientUri,
429
- :client_uris => :clientUris,
430
- :policy_uri => :policyUri,
431
- :policy_uris => :policyUris,
432
- :tos_uri => :tosUri,
433
- :tos_uris => :tosUris,
434
- :jwks_uri => :jwksUri,
435
- :sector_identifier => :sectorIdentifier,
436
- :subject_type => :subjectType,
437
- :id_token_sign_alg => :idTokenSignAlg,
438
- :id_token_encryption_alg => :idTokenEncryptionAlg,
439
- :id_token_encryption_enc => :idTokenEncryptionEnc,
440
- :user_info_sign_alg => :userInfoSignAlg,
441
- :user_info_encryption_alg => :userInfoEncryptionAlg,
442
- :user_info_encryption_enc => :userInfoEncryptionEnc,
443
- :request_sign_alg => :requestSignAlg,
444
- :request_encryption_alg => :requestEncryptionAlg,
445
- :request_encryption_enc => :requestEncryptionEnc,
446
- :token_auth_method => :tokenAuthMethod,
447
- :token_auth_sign_alg => :tokenAuthSignAlg,
448
- :default_max_age => :defaultMaxAge,
449
- :default_acrs => :defaultAcrs,
450
- :auth_time_required => :authTimeRequired,
451
- :login_uri => :loginUri,
452
- :request_uris => :requestUris,
453
- :created_at => :createdAt,
454
- :modified_at => :modifiedAt,
455
- :tls_client_auth_subject_dn => :tlsClientAuthSubjectDn,
456
- :tls_client_certificate_bound_access_tokens => :tlsClientCertificateBoundAccessTokens,
457
- :self_signed_certificate_key_id => :selfSignedCertificateKeyId,
458
- :authorization_sign_alg => :authorizationSignAlg,
459
- :authorization_encryption_alg => :authorizationEncryptionAlg,
460
- :authorization_encryption_enc => :authorizationEncryptionEnc,
461
- :bc_delivery_mode => :bcDeliveryMode,
462
- :bc_notification_endpoint => :bcNotificationEndpoint,
463
- :bc_request_sign_alg => :bcRequestSignAlg,
464
- :bc_user_code_required => :bcUserCodeRequired,
465
- :dynamically_registered => :dynamicallyRegistered,
466
- :tls_client_auth_san_email => :tlsClientAuthSanEmail,
467
- :tls_client_auth_san_ip => :tlsClientAuthSanIp,
468
- :tls_client_auth_san_uri => :tlsClientAuthSanUri,
469
- :tls_client_auth_san_dns => :tlsClientAuthSanDns,
470
- :sector_identifier_uri => :sectorIdentifierUri,
471
- :authorization_data_types => :authorizationDataTypes
420
+ :service_number => :serviceNumber,
421
+ :client_id => :clientId,
422
+ :client_id_alias => :clientIdAlias,
423
+ :client_id_alias_enabled => :clientIdAliasEnabled,
424
+ :client_secret => :clientSecret,
425
+ :client_type => :clientType,
426
+ :redirect_uris => :redirectUris,
427
+ :response_types => :responseTypes,
428
+ :grant_types => :grantTypes,
429
+ :application_type => :applicationType,
430
+ :client_name => :clientName,
431
+ :client_names => :clientNames,
432
+ :logo_uri => :logoUri,
433
+ :logo_uris => :logoUris,
434
+ :client_uri => :clientUri,
435
+ :client_uris => :clientUris,
436
+ :policy_uri => :policyUri,
437
+ :policy_uris => :policyUris,
438
+ :tos_uri => :tosUri,
439
+ :tos_uris => :tosUris,
440
+ :jwks_uri => :jwksUri,
441
+ :sector_identifier => :sectorIdentifier,
442
+ :subject_type => :subjectType,
443
+ :id_token_sign_alg => :idTokenSignAlg,
444
+ :id_token_encryption_alg => :idTokenEncryptionAlg,
445
+ :id_token_encryption_enc => :idTokenEncryptionEnc,
446
+ :user_info_sign_alg => :userInfoSignAlg,
447
+ :user_info_encryption_alg => :userInfoEncryptionAlg,
448
+ :user_info_encryption_enc => :userInfoEncryptionEnc,
449
+ :request_sign_alg => :requestSignAlg,
450
+ :request_encryption_alg => :requestEncryptionAlg,
451
+ :request_encryption_enc => :requestEncryptionEnc,
452
+ :token_auth_method => :tokenAuthMethod,
453
+ :token_auth_sign_alg => :tokenAuthSignAlg,
454
+ :default_max_age => :defaultMaxAge,
455
+ :default_acrs => :defaultAcrs,
456
+ :auth_time_required => :authTimeRequired,
457
+ :login_uri => :loginUri,
458
+ :request_uris => :requestUris,
459
+ :created_at => :createdAt,
460
+ :modified_at => :modifiedAt,
461
+ :tls_client_auth_subject_dn => :tlsClientAuthSubjectDn,
462
+ :tls_client_certificate_bound_access_tokens => :tlsClientCertificateBoundAccessTokens,
463
+ :self_signed_certificate_key_id => :selfSignedCertificateKeyId,
464
+ :authorization_sign_alg => :authorizationSignAlg,
465
+ :authorization_encryption_alg => :authorizationEncryptionAlg,
466
+ :authorization_encryption_enc => :authorizationEncryptionEnc,
467
+ :bc_delivery_mode => :bcDeliveryMode,
468
+ :bc_notification_endpoint => :bcNotificationEndpoint,
469
+ :bc_request_sign_alg => :bcRequestSignAlg,
470
+ :bc_user_code_required => :bcUserCodeRequired,
471
+ :dynamically_registered => :dynamicallyRegistered,
472
+ :tls_client_auth_san_email => :tlsClientAuthSanEmail,
473
+ :tls_client_auth_san_ip => :tlsClientAuthSanIp,
474
+ :tls_client_auth_san_uri => :tlsClientAuthSanUri,
475
+ :tls_client_auth_san_dns => :tlsClientAuthSanDns,
476
+ :sector_identifier_uri => :sectorIdentifierUri,
477
+ :authorization_data_types => :authorizationDataTypes,
478
+ :par_required => :parRequired
472
479
  }
473
480
 
474
481
  # The constructor
@@ -1,158 +1,158 @@
1
- # :nodoc:
2
- #
3
- # Copyright (C) 2014-2018 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 'set'
19
-
20
-
21
- module Authlete
22
- module Model
23
- class Scope < Authlete::Model::Hashable
24
- include Authlete::Utility
25
- # The attributes of this scopes. (Pair array)
26
- attr_accessor :attributes
27
-
28
- # The description about this scope. (String)
29
- attr_accessor :description
30
-
31
- # The descriptions about this scope with language tags.
32
- # (TaggedValue array)
33
- attr_accessor :descriptions
34
-
35
- # The name of this scope. (String)
36
- attr_accessor :name
37
-
38
- # The flag to indicate whether this scope is included in the
39
- # default scope set. (Boolean)
40
- attr_accessor :defaultEntry
41
- alias_method :default_entry, :defaultEntry
42
- alias_method :default_entry=, :defaultEntry=
43
-
44
- private
45
-
46
- # Boolean attributes.
47
- BOOLEAN_ATTRIBUTES = ::Set.new([ :defaultEntry ])
48
-
49
- # String attributes.
50
- STRING_ATTRIBUTES = ::Set.new([ :description, :name ])
51
-
52
- # Tagged value array attributes.
53
- TAGGED_VALUE_ARRAY_ATTRIBUTES = ::Set.new([ :descriptions ])
54
-
55
- # Mapping from snake cases to camel cases.
56
- SNAKE_TO_CAMEL = { :default_entry => :defaultEntry }
57
-
58
- # The constructor
59
- def initialize(hash = nil)
60
- # Set default values to boolean attributes.
61
- BOOLEAN_ATTRIBUTES.each do |attr|
62
- send("#{attr}=", false)
63
- end
64
-
65
- # Set default values to string attributes.
66
- STRING_ATTRIBUTES.each do |attr|
67
- send("#{attr}=", nil)
68
- end
69
-
70
- # Set default values to tagged value array attributes.
71
- TAGGED_VALUE_ARRAY_ATTRIBUTES.each do |attr|
72
- send("#{attr}=", nil)
73
- end
74
-
75
- # Set attribute values using the given hash.
76
- authlete_model_update(hash)
77
- end
78
-
79
- def authlete_model_convert_key(key)
80
- key = key.to_sym
81
-
82
- # Convert snakecase to camelcase, if necessary.
83
- if SNAKE_TO_CAMEL.has_key?(key)
84
- key = SNAKE_TO_CAMEL[key]
85
- end
86
-
87
- key
88
- end
89
-
90
- def authlete_model_simple_attribute?(key)
91
- BOOLEAN_ATTRIBUTES.include?(key) or
92
- STRING_ATTRIBUTES.include?(key)
93
- end
94
-
95
- def authlete_model_update(hash)
96
- return if hash.nil?
97
-
98
- hash.each do |key, value|
99
- key = authlete_model_convert_key(key)
100
-
101
- if authlete_model_simple_attribute?(key)
102
- send("#{key}=", value)
103
- elsif TAGGED_VALUE_ARRAY_ATTRIBUTES.include?(key)
104
- # Get an array consisting of "TaggedValue" objects.
105
- parsed = get_parsed_array(value) do |element|
106
- Authlete::Model::TaggedValue.parse(element)
107
- end
108
-
109
- send("#{key}=", parsed)
110
- elsif key == :attributes
111
- @attributes = get_parsed_array(value) do |element|
112
- Authlete::Model::Pair.parse(element)
113
- end
114
- end
115
- end
116
-
117
- self
118
- end
119
-
120
- public
121
-
122
- # Construct an instance from the given hash.
123
- #
124
- # If the given argument is nil or is not a Hash, nil is returned.
125
- # Otherwise, Scope.new(hash) is returned.
126
- def self.parse(hash)
127
- if hash.nil? or (hash.kind_of?(Hash) == false)
128
- return nil
129
- end
130
-
131
- Authlete::Model::Scope.new(hash)
132
- end
133
-
134
- # Set attribute values using the given hash.
135
- def update(hash)
136
- authlete_model_update(hash)
137
- end
138
-
139
- # Convert this object into a hash.
140
- def to_hash
141
- hash = {}
142
-
143
- instance_variables.each do |var|
144
- key = var.to_s.delete("@").to_sym
145
- val = instance_variable_get(var)
146
-
147
- if authlete_model_simple_attribute?(key) or val.nil?
148
- hash[key] = val
149
- elsif key == :attributes or key == :descriptions
150
- hash[key] = val.map { |element| element.to_hash }
151
- end
152
- end
153
-
154
- hash
155
- end
156
- end
157
- end
1
+ # :nodoc:
2
+ #
3
+ # Copyright (C) 2014-2018 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 'set'
19
+
20
+
21
+ module Authlete
22
+ module Model
23
+ class Scope < Authlete::Model::Hashable
24
+ include Authlete::Utility
25
+ # The attributes of this scopes. (Pair array)
26
+ attr_accessor :attributes
27
+
28
+ # The description about this scope. (String)
29
+ attr_accessor :description
30
+
31
+ # The descriptions about this scope with language tags.
32
+ # (TaggedValue array)
33
+ attr_accessor :descriptions
34
+
35
+ # The name of this scope. (String)
36
+ attr_accessor :name
37
+
38
+ # The flag to indicate whether this scope is included in the
39
+ # default scope set. (Boolean)
40
+ attr_accessor :defaultEntry
41
+ alias_method :default_entry, :defaultEntry
42
+ alias_method :default_entry=, :defaultEntry=
43
+
44
+ private
45
+
46
+ # Boolean attributes.
47
+ BOOLEAN_ATTRIBUTES = ::Set.new([ :defaultEntry ])
48
+
49
+ # String attributes.
50
+ STRING_ATTRIBUTES = ::Set.new([ :description, :name ])
51
+
52
+ # Tagged value array attributes.
53
+ TAGGED_VALUE_ARRAY_ATTRIBUTES = ::Set.new([ :descriptions ])
54
+
55
+ # Mapping from snake cases to camel cases.
56
+ SNAKE_TO_CAMEL = { :default_entry => :defaultEntry }
57
+
58
+ # The constructor
59
+ def initialize(hash = nil)
60
+ # Set default values to boolean attributes.
61
+ BOOLEAN_ATTRIBUTES.each do |attr|
62
+ send("#{attr}=", false)
63
+ end
64
+
65
+ # Set default values to string attributes.
66
+ STRING_ATTRIBUTES.each do |attr|
67
+ send("#{attr}=", nil)
68
+ end
69
+
70
+ # Set default values to tagged value array attributes.
71
+ TAGGED_VALUE_ARRAY_ATTRIBUTES.each do |attr|
72
+ send("#{attr}=", nil)
73
+ end
74
+
75
+ # Set attribute values using the given hash.
76
+ authlete_model_update(hash)
77
+ end
78
+
79
+ def authlete_model_convert_key(key)
80
+ key = key.to_sym
81
+
82
+ # Convert snakecase to camelcase, if necessary.
83
+ if SNAKE_TO_CAMEL.has_key?(key)
84
+ key = SNAKE_TO_CAMEL[key]
85
+ end
86
+
87
+ key
88
+ end
89
+
90
+ def authlete_model_simple_attribute?(key)
91
+ BOOLEAN_ATTRIBUTES.include?(key) or
92
+ STRING_ATTRIBUTES.include?(key)
93
+ end
94
+
95
+ def authlete_model_update(hash)
96
+ return if hash.nil?
97
+
98
+ hash.each do |key, value|
99
+ key = authlete_model_convert_key(key)
100
+
101
+ if authlete_model_simple_attribute?(key)
102
+ send("#{key}=", value)
103
+ elsif TAGGED_VALUE_ARRAY_ATTRIBUTES.include?(key)
104
+ # Get an array consisting of "TaggedValue" objects.
105
+ parsed = get_parsed_array(value) do |element|
106
+ Authlete::Model::TaggedValue.parse(element)
107
+ end
108
+
109
+ send("#{key}=", parsed)
110
+ elsif key == :attributes
111
+ @attributes = get_parsed_array(value) do |element|
112
+ Authlete::Model::Pair.parse(element)
113
+ end
114
+ end
115
+ end
116
+
117
+ self
118
+ end
119
+
120
+ public
121
+
122
+ # Construct an instance from the given hash.
123
+ #
124
+ # If the given argument is nil or is not a Hash, nil is returned.
125
+ # Otherwise, Scope.new(hash) is returned.
126
+ def self.parse(hash)
127
+ if hash.nil? or (hash.kind_of?(Hash) == false)
128
+ return nil
129
+ end
130
+
131
+ Authlete::Model::Scope.new(hash)
132
+ end
133
+
134
+ # Set attribute values using the given hash.
135
+ def update(hash)
136
+ authlete_model_update(hash)
137
+ end
138
+
139
+ # Convert this object into a hash.
140
+ def to_hash
141
+ hash = {}
142
+
143
+ instance_variables.each do |var|
144
+ key = var.to_s.delete("@").to_sym
145
+ val = instance_variable_get(var)
146
+
147
+ if authlete_model_simple_attribute?(key) or val.nil?
148
+ hash[key] = val
149
+ elsif key == :attributes or key == :descriptions
150
+ hash[key] = val.map { |element| element.to_hash }
151
+ end
152
+ end
153
+
154
+ hash
155
+ end
156
+ end
157
+ end
158
158
  end