Module: Saml::Kit::Templatable
- Included in:
- Builders::Assertion, Builders::AuthenticationRequest, Builders::IdentityProviderMetadata, Builders::LogoutRequest, Builders::LogoutResponse, Builders::Metadata, Builders::Response, Builders::ServiceProviderMetadata
- Defined in:
- lib/saml/kit/templatable.rb
Instance Attribute Summary collapse
-
#embed_signature ⇒ Object
Returns the value of attribute embed_signature.
Instance Method Summary collapse
- #encrypt? ⇒ Boolean
- #encryption_for(xml:) ⇒ Object
- #render(model, options) ⇒ Object
- #sign=(value) ⇒ Object
- #sign? ⇒ Boolean
- #signature_for(reference_id:, xml:) ⇒ Object
- #signatures ⇒ Object
- #to_xml(xml: ::Builder::XmlMarkup.new) ⇒ Object
Instance Attribute Details
#embed_signature ⇒ Object
Returns the value of attribute embed_signature.
4 5 6 |
# File 'lib/saml/kit/templatable.rb', line 4 def @embed_signature end |
Instance Method Details
#encrypt? ⇒ Boolean
40 41 42 |
# File 'lib/saml/kit/templatable.rb', line 40 def encrypt? encrypt && encryption_certificate end |
#encryption_for(xml:) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/saml/kit/templatable.rb', line 28 def encryption_for(xml:) if encrypt? temp = ::Builder::XmlMarkup.new yield temp signed_xml = signatures.complete(temp.target!) xml_encryption = Saml::Kit::Builders::XmlEncryption.new(signed_xml, encryption_certificate.public_key) render(xml_encryption, xml: xml) else yield xml end end |
#render(model, options) ⇒ Object
44 45 46 |
# File 'lib/saml/kit/templatable.rb', line 44 def render(model, ) Saml::Kit::Template.new(model).to_xml() end |
#sign=(value) ⇒ Object
6 7 8 9 |
# File 'lib/saml/kit/templatable.rb', line 6 def sign=(value) Saml::Kit.deprecate("sign= is deprecated. Use embed_signature= instead") self. = value end |
#sign? ⇒ Boolean
20 21 22 |
# File 'lib/saml/kit/templatable.rb', line 20 def sign? .nil? ? configuration.sign? : && configuration.sign? end |
#signature_for(reference_id:, xml:) ⇒ Object
15 16 17 18 |
# File 'lib/saml/kit/templatable.rb', line 15 def signature_for(reference_id:, xml:) return unless sign? render(signatures.build(reference_id), xml: xml) end |
#signatures ⇒ Object
24 25 26 |
# File 'lib/saml/kit/templatable.rb', line 24 def signatures @signatures ||= Saml::Kit::Signatures.new(configuration: configuration) end |
#to_xml(xml: ::Builder::XmlMarkup.new) ⇒ Object
11 12 13 |
# File 'lib/saml/kit/templatable.rb', line 11 def to_xml(xml: ::Builder::XmlMarkup.new) signatures.complete(render(self, xml: xml)) end |