Sha256: bc8a6eb7d131f985c6f99cbe0fd35018eaea8bfaa61c144f66e5c274d8899be0

Contents?: true

Size: 732 Bytes

Versions: 11

Compression:

Stored size: 732 Bytes

Contents

module Saml
  module Kit
    class Signature
      def initialize(xml_hash)
        @xml_hash = xml_hash
      end

      # Returns the embedded X509 Certificate
      def certificate
        value = to_h.fetch('KeyInfo', {}).fetch('X509Data', {}).fetch('X509Certificate', nil)
        return if value.nil?
        ::Xml::Kit::Certificate.new(value, use: :signing)
      end

      # Returns true when the fingerprint of the certificate matches one of the certificates registered in the metadata.
      def trusted?(metadata)
        return false if metadata.nil?
        metadata.matches?(certificate.fingerprint, use: :signing)
      end

      # Returns the XML Hash.
      def to_h
        @xml_hash
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
saml-kit-1.0.4 lib/saml/kit/signature.rb
saml-kit-1.0.3 lib/saml/kit/signature.rb
saml-kit-1.0.2 lib/saml/kit/signature.rb
saml-kit-1.0.1 lib/saml/kit/signature.rb
saml-kit-1.0.0 lib/saml/kit/signature.rb
saml-kit-0.3.6 lib/saml/kit/signature.rb
saml-kit-0.3.5 lib/saml/kit/signature.rb
saml-kit-0.3.4 lib/saml/kit/signature.rb
saml-kit-0.3.3 lib/saml/kit/signature.rb
saml-kit-0.3.2 lib/saml/kit/signature.rb
saml-kit-0.3.1 lib/saml/kit/signature.rb