Module: Samlr::Tools::LogoutRequestBuilder
- Defined in:
- lib/samlr/tools/logout_request_builder.rb
Overview
Use this for building the SAML logout request XML
Class Method Summary collapse
Class Method Details
.build(options = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/samlr/tools/logout_request_builder.rb', line 7 def self.build( = {}) name_id_format = [:name_id_format] || EMAIL_FORMAT # Mandatory name_id = .fetch(:name_id) issuer = .fetch(:issuer) builder = Nokogiri::XML::Builder.new do |xml| xml.LogoutRequest("xmlns:samlp" => NS_MAP["samlp"], "xmlns:saml" => NS_MAP["saml"], "ID" => Samlr::Tools.uuid, "IssueInstant" => Samlr::Tools::Timestamp.stamp, "Version" => "2.0") do xml.doc.root.namespace = xml.doc.root.namespace_definitions.find { |ns| ns.prefix == "samlp" } xml["saml"].Issuer(issuer) xml["saml"].NameID(name_id, "Format" => name_id_format) end end builder.to_xml(COMPACT) end |