Class: Saml::Kit::Builders::XmlSignature

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

Constant Summary collapse

SIGNATURE_METHODS =
{
  SHA1: "http://www.w3.org/2000/09/xmldsig#rsa-sha1",
  SHA224: "http://www.w3.org/2001/04/xmldsig-more#rsa-sha224",
  SHA256: "http://www.w3.org/2001/04/xmldsig-more#rsa-sha256",
  SHA384: "http://www.w3.org/2001/04/xmldsig-more#rsa-sha384",
  SHA512: "http://www.w3.org/2001/04/xmldsig-more#rsa-sha512",
}.freeze
DIGEST_METHODS =
{
  SHA1: "http://www.w3.org/2000/09/xmldsig#SHA1",
  SHA224: "http://www.w3.org/2001/04/xmldsig-more#sha224",
  SHA256: "http://www.w3.org/2001/04/xmlenc#sha256",
  SHA384: "http://www.w3.org/2001/04/xmldsig-more#sha384",
  SHA512: "http://www.w3.org/2001/04/xmlenc#sha512",
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(reference_id, configuration:) ⇒ XmlSignature

Returns a new instance of XmlSignature.



24
25
26
27
28
# File 'lib/saml/kit/builders/xml_signature.rb', line 24

def initialize(reference_id, configuration:)
  @configuration = configuration
  @reference_id = reference_id
  @x509_certificate = configuration.certificates(use: :signing).last.stripped
end

Instance Attribute Details

#configuration ⇒ Object (readonly)

Returns the value of attribute configuration.



20
21
22
# File 'lib/saml/kit/builders/xml_signature.rb', line 20

def configuration
  @configuration
end

#embed_signature ⇒ Object (readonly)

Returns the value of attribute embed_signature.



20
21
22
# File 'lib/saml/kit/builders/xml_signature.rb', line 20

def embed_signature
  @embed_signature
end

#reference_id ⇒ Object (readonly)

Returns the value of attribute reference_id.



21
22
23
# File 'lib/saml/kit/builders/xml_signature.rb', line 21

def reference_id
  @reference_id
end

#x509_certificate ⇒ Object (readonly)

Returns the value of attribute x509_certificate.



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

def x509_certificate
  @x509_certificate
end

Instance Method Details

#digest_method ⇒ Object



34
35
36
# File 'lib/saml/kit/builders/xml_signature.rb', line 34

def digest_method
  DIGEST_METHODS[configuration.digest_method]
end

#signature_method ⇒ Object



30
31
32
# File 'lib/saml/kit/builders/xml_signature.rb', line 30

def signature_method
  SIGNATURE_METHODS[configuration.signature_method]
end