@@ -77,6 +77,34 @@ class SettingsTest < Minitest::Test
77
77
assert_equal new_settings . security [ :signature_method ] , XMLSecurity ::Document ::RSA_SHA1
78
78
end
79
79
80
+ it "overrides only provided security attributes passing a second parameter" do
81
+ config = {
82
+ :security => {
83
+ :metadata_signed => true
84
+ }
85
+ }
86
+
87
+ @default_attributes = OneLogin ::RubySaml ::Settings ::DEFAULTS
88
+
89
+ @settings = OneLogin ::RubySaml ::Settings . new ( config , true )
90
+ assert_equal @settings . security [ :metadata_signed ] , true
91
+ assert_equal @settings . security [ :digest_method ] , @default_attributes [ :security ] [ :digest_method ]
92
+ end
93
+
94
+ it "doesn't override only provided security attributes without passing a second parameter" do
95
+ config = {
96
+ :security => {
97
+ :metadata_signed => true
98
+ }
99
+ }
100
+
101
+ @default_attributes = OneLogin ::RubySaml ::Settings ::DEFAULTS
102
+
103
+ @settings = OneLogin ::RubySaml ::Settings . new ( config )
104
+ assert_equal @settings . security [ :metadata_signed ] , true
105
+ assert_equal @settings . security [ :digest_method ] , nil
106
+ end
107
+
80
108
describe "#single_logout_service_url" do
81
109
it "when single_logout_service_url is nil but assertion_consumer_logout_service_url returns its value" do
82
110
@settings . single_logout_service_url = nil
@@ -93,7 +121,7 @@ class SettingsTest < Minitest::Test
93
121
94
122
assert_equal "urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" , @settings . single_logout_service_binding
95
123
end
96
- end
124
+ end
97
125
98
126
describe "#get_idp_cert" do
99
127
it "returns nil when the cert is an empty string" do
@@ -169,7 +197,7 @@ class SettingsTest < Minitest::Test
169
197
170
198
assert @settings . get_idp_cert_multi . kind_of? Hash
171
199
assert @settings . get_idp_cert_multi [ :signing ] . kind_of? Array
172
- assert @settings . get_idp_cert_multi [ :encryption ] . kind_of? Array
200
+ assert @settings . get_idp_cert_multi [ :encryption ] . kind_of? Array
173
201
assert @settings . get_idp_cert_multi [ :signing ] [ 0 ] . kind_of? OpenSSL ::X509 ::Certificate
174
202
assert @settings . get_idp_cert_multi [ :encryption ] [ 0 ] . kind_of? OpenSSL ::X509 ::Certificate
175
203
end
0 commit comments