Class: Spid::Saml2::XmlSignature
- Inherits:
-
Object
- Object
- Spid::Saml2::XmlSignature
- Defined in:
- lib/spid/saml2/xml_signature.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
-
#sign_reference ⇒ Object
readonly
Returns the value of attribute sign_reference.
Instance Method Summary collapse
- #canonicalization_method ⇒ Object
- #digest_method ⇒ Object
- #digest_value ⇒ Object
-
#initialize(settings:, sign_reference:) ⇒ XmlSignature
constructor
A new instance of XmlSignature.
- #reference ⇒ Object
- #signature ⇒ Object
- #signature_method ⇒ Object
- #signature_value ⇒ Object
- #signed_info ⇒ Object
- #transform_enveloped ⇒ Object
- #transform_xml ⇒ Object
- #transforms ⇒ Object
Constructor Details
#initialize(settings:, sign_reference:) ⇒ XmlSignature
Returns a new instance of XmlSignature.
9 10 11 12 |
# File 'lib/spid/saml2/xml_signature.rb', line 9 def initialize(settings:, sign_reference:) @settings = settings @sign_reference = sign_reference end |
Instance Attribute Details
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
6 7 8 |
# File 'lib/spid/saml2/xml_signature.rb', line 6 def settings @settings end |
#sign_reference ⇒ Object (readonly)
Returns the value of attribute sign_reference.
7 8 9 |
# File 'lib/spid/saml2/xml_signature.rb', line 7 def sign_reference @sign_reference end |
Instance Method Details
#canonicalization_method ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/spid/saml2/xml_signature.rb', line 35 def canonicalization_method @canonicalization_method ||= begin element = REXML::Element.new("ds:CanonicalizationMethod") element.add_attributes( "Algorithm" => "http://www.w3.org/2001/10/xml-exc-c14n#" ) element end end |
#digest_method ⇒ Object
100 101 102 103 104 105 106 107 |
# File 'lib/spid/saml2/xml_signature.rb', line 100 def digest_method @digest_method ||= begin element = REXML::Element.new("ds:DigestMethod") element.add_attributes("Algorithm" => settings.digest_method) element end end |
#digest_value ⇒ Object
109 110 111 |
# File 'lib/spid/saml2/xml_signature.rb', line 109 def digest_value @digest_value ||= REXML::Element.new("ds:DigestValue") end |
#reference ⇒ Object
55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/spid/saml2/xml_signature.rb', line 55 def reference @reference ||= begin element = REXML::Element.new("ds:Reference") element.add_attributes("URI" => "##{sign_reference}") element.add_element(transforms) element.add_element(digest_method) element.add_element(digest_value) element end end |
#signature ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/spid/saml2/xml_signature.rb', line 14 def signature @signature ||= begin element = REXML::Element.new("ds:Signature") element.add_element(signed_info) element.add_element(signature_value) element end end |
#signature_method ⇒ Object
46 47 48 49 50 51 52 53 |
# File 'lib/spid/saml2/xml_signature.rb', line 46 def signature_method @signature_method ||= begin element = REXML::Element.new("ds:SignatureMethod") element.add_attributes("Algorithm" => settings.signature_method) element end end |
#signature_value ⇒ Object
113 114 115 |
# File 'lib/spid/saml2/xml_signature.rb', line 113 def signature_value @signature_value ||= REXML::Element.new("ds:SignatureValue") end |
#signed_info ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/spid/saml2/xml_signature.rb', line 24 def signed_info @signed_info ||= begin element = REXML::Element.new("ds:SignedInfo") element.add_element(canonicalization_method) element.add_element(signature_method) element.add_element(reference) element end end |
#transform_enveloped ⇒ Object
77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/spid/saml2/xml_signature.rb', line 77 def transform_enveloped @transform_enveloped ||= begin element = REXML::Element.new("ds:Transform") element.add_attributes( "Algorithm" => "http://www.w3.org/2000/09/xmldsig#enveloped-signature" ) element end end |
#transform_xml ⇒ Object
89 90 91 92 93 94 95 96 97 98 |
# File 'lib/spid/saml2/xml_signature.rb', line 89 def transform_xml @transform_xml ||= begin element = REXML::Element.new("ds:Transform") element.add_attributes( "Algorithm" => "http://www.w3.org/2001/10/xml-exc-c14n#" ) element end end |
#transforms ⇒ Object
67 68 69 70 71 72 73 74 75 |
# File 'lib/spid/saml2/xml_signature.rb', line 67 def transforms @transforms ||= begin element = REXML::Element.new("ds:Transforms") element.add_element(transform_enveloped) element.add_element(transform_xml) element end end |