Skip to content

Commit 9e6849e

Browse files
committed
Make ruby-saml 1.8.7 compatible
1 parent 367189d commit 9e6849e

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

lib/onelogin/ruby-saml/idp_metadata_parser.rb

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module RubySaml
1212
# Auxiliary class to retrieve and parse the Identity Provider Metadata
1313
#
1414
class IdpMetadataParser
15+
1516
module SamlMetadata
1617
module Vocabulary
1718
METADATA = "urn:oasis:names:tc:SAML:2.0:metadata"
@@ -385,7 +386,9 @@ def merge_parsed_metadata_into(settings, parsed_metadata)
385386
settings
386387
end
387388

388-
private_constant :SamlMetadata, :IdpMetadata
389+
if self.respond_to?(:private_constant)
390+
private_constant :SamlMetadata, :IdpMetadata
391+
end
389392
end
390393
end
391394
end

lib/onelogin/ruby-saml/utils.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ class Utils
2222
#
2323
def self.format_cert(cert)
2424
# don't try to format an encoded certificate or if is empty or nil
25-
return cert if cert.nil? || cert.empty? || !cert.ascii_only?
25+
if cert.respond_to?(:ascii_only?)
26+
return cert if cert.nil? || cert.empty? || !cert.ascii_only?
27+
else
28+
return cert if cert.nil? || cert.empty? || cert.match(/\x0d/)
29+
end
2630

2731
if cert.scan(/BEGIN CERTIFICATE/).length > 1
2832
formatted_cert = []

0 commit comments

Comments
 (0)