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::CONSTRUCTORS, Document::XPATH
Constants included from XsdValidatable
XsdValidatable::METADATA_XSD, XsdValidatable::PROTOCOL_XSD
Constants included from XmlParseable
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_saml_document, #version
Methods included from XmlParseable
#present?, #to_h, #to_s, #to_xhtml, #to_xml
Methods included from Trustable
Constructor Details
#initialize(xml, configuration: Saml::Kit.configuration) ⇒ LogoutRequest
A new instance of LogoutRequest
36 37 38 |
# File 'lib/saml/kit/logout_request.rb', line 36 def initialize(xml, configuration: Saml::Kit.configuration) super(xml, name: 'LogoutRequest', configuration: configuration) end |
Instance Method Details
#name_id ⇒ Object
Returns the NameID value.
41 42 43 |
# File 'lib/saml/kit/logout_request.rb', line 41 def name_id at_xpath('./*/saml:NameID').try(:text) end |
#name_id_format ⇒ Object
45 46 47 |
# File 'lib/saml/kit/logout_request.rb', line 45 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.
‘:http_post`. RelayState param. return to the requestor.
58 59 60 61 62 63 64 |
# File 'lib/saml/kit/logout_request.rb', line 58 def response_for(binding:, relay_state: nil) builder = Saml::Kit::LogoutResponse.builder(self) do |xxx| yield xxx if block_given? end response_binding = provider.single_logout_service_for(binding: binding) response_binding.serialize(builder, relay_state: relay_state) end |