Class: Saml::Kit::LogoutRequest

Inherits:
Document
  • Object
show all
Includes:
Requestable
Defined in:
lib/saml/kit/logout_request.rb

Overview

This class parses a LogoutRequest SAML document.

Constant Summary collapse

Builder =
Deprecated.

Use Builders::LogoutRequest instead of this.

ActiveSupport::Deprecation::DeprecatedConstantProxy.new('Saml::Kit::LogoutRequest::Builder', 'Saml::Kit::Builders::LogoutRequest')

Constants inherited from Document

Document::PROTOCOL_XSD

Instance Method Summary collapse

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

#signed?, #trusted?

Constructor Details

#initialize(xml, configuration: Saml::Kit.configuration) ⇒ LogoutRequest

Returns a new instance of LogoutRequest.



8
9
10
# File 'lib/saml/kit/logout_request.rb', line 8

def initialize(xml, configuration: Saml::Kit.configuration)
  super(xml, name: "LogoutRequest", configuration: configuration)
end

Instance Method Details

#name_idObject

Returns the NameID value.



13
14
15
# File 'lib/saml/kit/logout_request.rb', line 13

def name_id
  to_h[name]['NameID']
end

#response_for(binding:, relay_state: nil) ⇒ Array

Generates a Serialized LogoutResponse using the encoding rules for the specified binding.

Parameters:

  • binding (Symbol)

    The binding to use ‘:http_redirect` or `:http_post`.

  • relay_state (Object) (defaults to: nil)

    The RelayState to include in the RelayState param.

Returns:

  • (Array)

    Returns an array with a url and Hash of parameters to return to the requestor.



22
23
24
25
26
27
28
# File 'lib/saml/kit/logout_request.rb', line 22

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