Skip to content

Commit

Permalink
Fix fingerprint method
Browse files Browse the repository at this point in the history
#fingerprint method memoizes its result, and it should not b/c it takes arguments.
  • Loading branch information
pitbulk authored Jan 13, 2025
1 parent 130b829 commit c70e911
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions lib/onelogin/ruby-saml/idp_metadata_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -384,14 +384,12 @@ def certificates
# @return [String|nil] the fingerpint of the X509Certificate if it exists
#
def fingerprint(certificate, fingerprint_algorithm = XMLSecurity::Document::SHA1)
@fingerprint ||= begin
return unless certificate
return unless certificate

cert = OpenSSL::X509::Certificate.new(Base64.decode64(certificate))
cert = OpenSSL::X509::Certificate.new(Base64.decode64(certificate))

fingerprint_alg = XMLSecurity::BaseDocument.new.algorithm(fingerprint_algorithm).new
fingerprint_alg.hexdigest(cert.to_der).upcase.scan(/../).join(":")
end
fingerprint_alg = XMLSecurity::BaseDocument.new.algorithm(fingerprint_algorithm).new
fingerprint_alg.hexdigest(cert.to_der).upcase.scan(/../).join(":")
end

# @return [Array] the names of all SAML attributes if any exist
Expand Down

0 comments on commit c70e911

Please sign in to comment.