@@ -10,16 +10,18 @@ module RubySaml
1010 # SAML2 Toolkit Settings
1111 #
1212 class Settings
13- def initialize ( overrides = { } , keep_security_attributes = false )
13+ def initialize ( overrides = { } , keep_security_attributes = false , keep_extensions_attributes = true )
14+ config = DEFAULTS . merge ( overrides )
1415 if keep_security_attributes
1516 security_attributes = overrides . delete ( :security ) || { }
16- config = DEFAULTS . merge ( overrides )
1717 config [ :security ] = DEFAULTS [ :security ] . merge ( security_attributes )
18- else
19- config = DEFAULTS . merge ( overrides )
18+ end
19+ if keep_extensions_attributes
20+ extensions_attributes = overrides . delete ( :extensions ) || { }
21+ config [ :extensions ] = DEFAULTS [ :extensions ] . merge ( extensions_attributes )
2022 end
2123
22- config . each do |k , v |
24+ config . each do |k , v |
2325 acc = "#{ k . to_s } =" . to_sym
2426 if respond_to? acc
2527 value = v . is_a? ( Hash ) ? v . dup : v
@@ -69,6 +71,8 @@ def initialize(overrides = {}, keep_security_attributes = false)
6971 attr_accessor :assertion_consumer_logout_service_url
7072 attr_accessor :assertion_consumer_logout_service_binding
7173 attr_accessor :issuer
74+ # EIDAS / samlp:Extensions
75+ attr_accessor :extensions
7276
7377 # @return [String] SP Entity ID
7478 #
@@ -164,7 +168,7 @@ def get_idp_cert_multi
164168
165169 raise ArgumentError . new ( "Invalid value for idp_cert_multi" ) if not idp_cert_multi . is_a? ( Hash )
166170
167- certs = { :signing => [ ] , :encryption => [ ] }
171+ certs = { :signing => [ ] , :encryption => [ ] }
168172
169173 if idp_cert_multi . key? ( :signing ) and not idp_cert_multi [ :signing ] . empty?
170174 idp_cert_multi [ :signing ] . each do |idp_cert |
@@ -221,27 +225,31 @@ def get_sp_key
221225 private
222226
223227 DEFAULTS = {
224- :assertion_consumer_service_binding => "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" . freeze ,
225- :single_logout_service_binding => "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" . freeze ,
226- :idp_cert_fingerprint_algorithm => XMLSecurity ::Document ::SHA1 ,
227- :compress_request => true ,
228- :compress_response => true ,
229- :soft => true ,
230- :double_quote_xml_attribute_values => false ,
231- :security => {
232- :authn_requests_signed => false ,
233- :logout_requests_signed => false ,
234- :logout_responses_signed => false ,
235- :want_assertions_signed => false ,
236- :want_assertions_encrypted => false ,
237- :want_name_id => false ,
238- :metadata_signed => false ,
239- :embed_sign => false ,
240- :digest_method => XMLSecurity ::Document ::SHA1 ,
241- :signature_method => XMLSecurity ::Document ::RSA_SHA1 ,
242- :check_idp_cert_expiration => false ,
243- :check_sp_cert_expiration => false
244- } . freeze
228+ :assertion_consumer_service_binding => "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" . freeze ,
229+ :single_logout_service_binding => "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" . freeze ,
230+ :idp_cert_fingerprint_algorithm => XMLSecurity ::Document ::SHA1 ,
231+ :compress_request => true ,
232+ :compress_response => true ,
233+ :soft => true ,
234+ :double_quote_xml_attribute_values => false ,
235+ :extensions => {
236+ :sptype => false ,
237+ :requested_attributes => false
238+ } . freeze ,
239+ :security => {
240+ :authn_requests_signed => false ,
241+ :logout_requests_signed => false ,
242+ :logout_responses_signed => false ,
243+ :want_assertions_signed => false ,
244+ :want_assertions_encrypted => false ,
245+ :want_name_id => false ,
246+ :metadata_signed => false ,
247+ :embed_sign => false ,
248+ :digest_method => XMLSecurity ::Document ::SHA1 ,
249+ :signature_method => XMLSecurity ::Document ::RSA_SHA1 ,
250+ :check_idp_cert_expiration => false ,
251+ :check_sp_cert_expiration => false
252+ } . freeze
245253 } . freeze
246254 end
247255 end
0 commit comments