Commit f2543d8
Changed files (2)
lib
saml
kit
spec
saml
lib/saml/kit/fingerprint.rb
@@ -17,6 +17,14 @@ module Saml
self.to_s == other.to_s
end
+ def eql?(other)
+ self == other
+ end
+
+ def hash
+ to_s.hash
+ end
+
def to_s
algorithm(OpenSSL::Digest::SHA256)
end
spec/saml/fingerprint_spec.rb
@@ -18,4 +18,12 @@ RSpec.describe Saml::Kit::Fingerprint do
expect(described_class.new(certificate).algorithm(OpenSSL::Digest::SHA1)).to eql(sha1)
end
end
+
+ it 'produces correct hash keys' do
+ certificate, _ = Saml::Kit::SelfSignedCertificate.new("password").create
+ items = { }
+ items[described_class.new(certificate)] = "HI"
+ items[described_class.new(certificate)] = "BYE"
+ expect(items.keys.count).to eql(1)
+ end
end