Class: Saml::Kit::Signature

Inherits:
Object
  • Object
show all
Defined in:
lib/saml/kit/signature.rb

Instance Method Summary collapse

Constructor Details

#initialize(xml_hash) ⇒ Signature

Returns a new instance of Signature.



4
5
6
# File 'lib/saml/kit/signature.rb', line 4

def initialize(xml_hash)
  @xml_hash = xml_hash
end

Instance Method Details

#certificateObject



8
9
10
11
12
# File 'lib/saml/kit/signature.rb', line 8

def certificate
  value = to_h.fetch('KeyInfo', {}).fetch('X509Data', {}).fetch('X509Certificate', nil)
  return if value.nil?
  Saml::Kit::Certificate.new(value, use: :signing)
end

#to_hObject



19
20
21
# File 'lib/saml/kit/signature.rb', line 19

def to_h
  @xml_hash
end

#trusted?(metadata) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
# File 'lib/saml/kit/signature.rb', line 14

def trusted?()
  return false if .nil?
  .matches?(certificate.fingerprint, use: :signing)
end