Skip to content

Commit

Permalink
Make ruby-saml 1.8.7 compatible
Browse files Browse the repository at this point in the history
  • Loading branch information
pitbulk committed Apr 8, 2019
1 parent 367189d commit 9e6849e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
5 changes: 4 additions & 1 deletion lib/onelogin/ruby-saml/idp_metadata_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ module RubySaml
# Auxiliary class to retrieve and parse the Identity Provider Metadata
#
class IdpMetadataParser

module SamlMetadata
module Vocabulary
METADATA = "urn:oasis:names:tc:SAML:2.0:metadata"
Expand Down Expand Up @@ -385,7 +386,9 @@ def merge_parsed_metadata_into(settings, parsed_metadata)
settings
end

private_constant :SamlMetadata, :IdpMetadata
if self.respond_to?(:private_constant)
private_constant :SamlMetadata, :IdpMetadata
end
end
end
end
6 changes: 5 additions & 1 deletion lib/onelogin/ruby-saml/utils.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ class Utils
#
def self.format_cert(cert)
# don't try to format an encoded certificate or if is empty or nil
return cert if cert.nil? || cert.empty? || !cert.ascii_only?
if cert.respond_to?(:ascii_only?)
return cert if cert.nil? || cert.empty? || !cert.ascii_only?
else
return cert if cert.nil? || cert.empty? || cert.match(/\x0d/)
end

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

0 comments on commit 9e6849e

Please sign in to comment.