Skip to content

Commit 9d0323b

Browse files
committed
Merge pull request #200 from Umofomia/ruby-1.8-ssl-cert-store
Set default SSL certificate store in Ruby 1.8.
2 parents 90fdb4b + 8f861b2 commit 9d0323b

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lib/onelogin/ruby-saml/idp_metadata_parser.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ def get_idp_metadata(url, validate_cert)
4747
# Most IdPs will probably use self signed certs
4848
if validate_cert
4949
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
50+
51+
# Net::HTTP in Ruby 1.8 did not set the default certificate store
52+
# automatically when VERIFY_PEER was specified.
53+
if RUBY_VERSION < '1.9' && !http.ca_file && !http.ca_path && !http.cert_store
54+
http.cert_store = OpenSSL::SSL::SSLContext::DEFAULT_CERT_STORE
55+
end
5056
else
5157
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
5258
end

0 commit comments

Comments
 (0)