Skip to content

Commit b27dd60

Browse files
Alexandre Chakrounalxckn
authored andcommitted
Add support idp_cert_multi with string keys
1 parent eb70449 commit b27dd60

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

lib/onelogin/ruby-saml/settings.rb

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -195,17 +195,13 @@ def get_idp_cert_multi
195195

196196
certs = {:signing => [], :encryption => [] }
197197

198-
if idp_cert_multi.key?(:signing) and not idp_cert_multi[:signing].empty?
199-
idp_cert_multi[:signing].each do |idp_cert|
200-
formatted_cert = OneLogin::RubySaml::Utils.format_cert(idp_cert)
201-
certs[:signing].push(OpenSSL::X509::Certificate.new(formatted_cert))
202-
end
203-
end
198+
[:signing, :encryption].each do |type|
199+
certs_for_type = idp_cert_multi[type] || idp_cert_multi[type.to_s]
200+
next if !certs_for_type || certs_for_type.empty?
204201

205-
if idp_cert_multi.key?(:encryption) and not idp_cert_multi[:encryption].empty?
206-
idp_cert_multi[:encryption].each do |idp_cert|
202+
certs_for_type.each do |idp_cert|
207203
formatted_cert = OneLogin::RubySaml::Utils.format_cert(idp_cert)
208-
certs[:encryption].push(OpenSSL::X509::Certificate.new(formatted_cert))
204+
certs[type].push(OpenSSL::X509::Certificate.new(formatted_cert))
209205
end
210206
end
211207

0 commit comments

Comments
 (0)