Sha256: e9d67f70cf1324969d4df2a660c1db1c0236c536dbf131cd56874bba400b97c7
Contents?: true
Size: 1.15 KB
Versions: 7
Compression:
Stored size: 1.15 KB
Contents
module Saml module Kit class Signatures attr_reader :configuration def initialize(configuration:) @configuration = configuration end def build(reference_id) return nil unless configuration.sign? Saml::Kit::Builders::XmlSignature.new(reference_id, configuration: configuration) end def complete(raw_xml) return raw_xml unless configuration.sign? private_key = configuration.private_keys(use: :signing).last Xmldsig::SignedDocument.new(raw_xml).sign(private_key) end def self.sign(xml: ::Builder::XmlMarkup.new, configuration: Saml::Kit.configuration) signatures = Saml::Kit::Signatures.new(configuration: configuration) yield xml, XmlSignatureTemplate.new(xml, signatures) signatures.complete(xml.target!) end class XmlSignatureTemplate attr_reader :signatures, :xml def initialize(xml, signatures) @signatures = signatures @xml = xml end def template(reference_id) Template.new(signatures.build(reference_id)).to_xml(xml: xml) end end end end end
Version data entries
7 entries across 7 versions & 1 rubygems