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 |
# File 'lib/samlr/tools/logout_request_builder.rb', line 7 def self.build( = {}) # 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, ()) end end builder.to_xml(COMPACT) end |
.format_option(options) ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/samlr/tools/logout_request_builder.rb', line 31 def self.format_option() if [:name_id_format] warn "[DEPRECATION] options[:name_id_format] is deprecated. Please use options[:name_id_options][:format] instead" [:name_id_format] elsif [:name_id_options] && [:name_id_options][:format] [:name_id_options][:format] else EMAIL_FORMAT end end |
.logout_options(options) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/samlr/tools/logout_request_builder.rb', line 23 def self.() = [:name_id_options] || {} = { "Format" => format_option() } .merge!("NameQualifier" => [:name_qualifier]) if [:name_qualifier] .merge!("SPNameQualifier" => [:spname_qualifier]) if [:spname_qualifier] end |