Module: Saml::Kit::Trustable

Extended by:
ActiveSupport::Concern
Included in:
Document
Defined in:
lib/saml/kit/trustable.rb

Instance Method Summary collapse

Instance Method Details

#certificate ⇒ Object



12
13
14
15
# File 'lib/saml/kit/trustable.rb', line 12

def certificate
  return unless signed?
  to_h.fetch(name, {}).fetch('Signature', {}).fetch('KeyInfo', {}).fetch('X509Data', {}).fetch('X509Certificate', nil)
end

#fingerprint ⇒ Object



17
18
19
20
# File 'lib/saml/kit/trustable.rb', line 17

def fingerprint
  return if certificate.blank?
  Fingerprint.new(certificate)
end

#provider ⇒ Object



32
33
34
# File 'lib/saml/kit/trustable.rb', line 32

def provider
  Saml::Kit.registry.(issuer)
end

#signature_verified! ⇒ Object



36
37
38
# File 'lib/saml/kit/trustable.rb', line 36

def signature_verified!
  @signature_manually_verified = true
end

#signed? ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/saml/kit/trustable.rb', line 22

def signed?
  to_h.fetch(name, {}).fetch('Signature', nil).present?
end

#trusted? ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
29
30
# File 'lib/saml/kit/trustable.rb', line 26

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