Class: Saml::Kit::LogoutRequest
- Includes:
- Requestable
- Defined in:
- lib/saml/kit/logout_request.rb
Overview
This class can be used to parse a LogoutRequest SAML document.
document = Saml::Kit::LogoutRequest.new(raw_xml)
It can also be used to generate a new LogoutRequest.
document = Saml::Kit::LogoutRequest.build do |builder|
builder.issuer = "issuer"
end
puts document.to_xml(pretty: true)
See Builders::LogoutRequest for a list of available settings.
This class can also be used to generate the correspondong LogoutResponse for a LogoutRequest.
document = Saml::Kit::LogoutRequest.new(raw_xml)
url, saml_params = document.response_for(binding: :http_post)
See #response_for for more information.
Constant Summary
Constants inherited from Document
Document::NAMESPACES, Document::PROTOCOL_XSD, Document::XPATH
Instance Attribute Summary
Attributes inherited from Document
Instance Method Summary collapse
-
#initialize(xml, configuration: Saml::Kit.configuration) ⇒ LogoutRequest
constructor
A new instance of LogoutRequest.
-
#name_id ⇒ Object
Returns the NameID value.
- #name_id_format ⇒ Object
-
#response_for(binding:, relay_state: nil) ⇒ Array
Generates a Serialized LogoutResponse using the encoding rules for the specified binding.
Methods inherited from Document
#destination, #id, #issue_instant, #issuer, #to_h, #to_s, to_saml_document, #to_xhtml, #to_xml, #version
Methods included from Trustable
Constructor Details
#initialize(xml, configuration: Saml::Kit.configuration) ⇒ LogoutRequest
A new instance of LogoutRequest
35 36 37 |
# File 'lib/saml/kit/logout_request.rb', line 35 def initialize(xml, configuration: Saml::Kit.configuration) super(xml, name: 'LogoutRequest', configuration: configuration) end |
Instance Method Details
#name_id ⇒ Object
Returns the NameID value.
40 41 42 |
# File 'lib/saml/kit/logout_request.rb', line 40 def name_id at_xpath('./*/saml:NameID').try(:text) end |
#name_id_format ⇒ Object
44 45 46 |
# File 'lib/saml/kit/logout_request.rb', line 44 def name_id_format at_xpath('./*/saml:NameID/@Format').try(:value) end |
#response_for(binding:, relay_state: nil) ⇒ Array
Generates a Serialized LogoutResponse using the encoding rules for the specified binding.
53 54 55 56 57 58 59 |
# File 'lib/saml/kit/logout_request.rb', line 53 def response_for(binding:, relay_state: nil) builder = Saml::Kit::LogoutResponse.builder(self) do |x| yield x if block_given? end response_binding = provider.single_logout_service_for(binding: binding) response_binding.serialize(builder, relay_state: relay_state) end |