class OneLogin::RubySaml::SloLogoutrequest

SAML2 Logout Request (SLO IdP initiated, Parser)

Attributes

document[R]
options[R]
request[R]
settings[RW]

OneLogin::RubySaml::Settings Toolkit settings

soft[RW]

Public Instance Methods

id() click to toggle source

@return [String|nil] Gets the ID attribute from the Logout Request. if exists.

# File lib/onelogin/ruby-saml/slo_logoutrequest.rb, line 71
def id
  super(document)
end
is_valid?(collect_errors = false) click to toggle source

Validates the Logout Request with the default values (soft = true) @param collect_errors [Boolean] Stop validation when first error appears or keep validating. @return [Boolean] TRUE if the Logout Request is valid

# File lib/onelogin/ruby-saml/slo_logoutrequest.rb, line 54
def is_valid?(collect_errors = false)
  validate(collect_errors)
end
issuer() click to toggle source

@return [String] Gets the Issuer from the Logout Request.

# File lib/onelogin/ruby-saml/slo_logoutrequest.rb, line 77
def issuer
  @issuer ||= begin
    node = REXML::XPath.first(
      document,
      "/p:LogoutRequest/a:Issuer",
      { "p" => PROTOCOL, "a" => ASSERTION }
    )
    node.nil? ? nil : node.text
  end
end
name_id() click to toggle source

@return [String] Gets the NameID of the Logout Request.

# File lib/onelogin/ruby-saml/slo_logoutrequest.rb, line 60
def name_id
  @name_id ||= begin
    node = REXML::XPath.first(document, "/p:LogoutRequest/a:NameID", { "p" => PROTOCOL, "a" => ASSERTION })
    node.nil? ? nil : node.text
  end
end
Also aliased as: nameid
nameid() click to toggle source
Alias for: name_id
not_on_or_after() click to toggle source

@return [Time|nil] Gets the NotOnOrAfter Attribute value if exists.

# File lib/onelogin/ruby-saml/slo_logoutrequest.rb, line 90
def not_on_or_after
  @not_on_or_after ||= begin
    node = REXML::XPath.first(
      document,
      "/p:LogoutRequest",
      { "p" => PROTOCOL }
    )
    if node && node.attributes["NotOnOrAfter"]
      Time.parse(node.attributes["NotOnOrAfter"])
    end
  end
end
session_indexes() click to toggle source

@return [Array] Gets the SessionIndex if exists (Supported multiple values). Empty Array if none found

# File lib/onelogin/ruby-saml/slo_logoutrequest.rb, line 105
def session_indexes
  s_indexes = []
  nodes = REXML::XPath.match(
    document,
    "/p:LogoutRequest/p:SessionIndex",
    { "p" => PROTOCOL }
  )

  nodes.each do |node|
    s_indexes << node.text
  end

  s_indexes
end

Public Class Methods

new(request, options = {}) click to toggle source

Constructs the Logout Request. A Logout Request Object that is an extension of the SamlMessage class. @param request [String] A UUEncoded Logout Request from the IdP. @param options [Hash] :settings to provide the OneLogin::RubySaml::Settings object

Or :allowed_clock_drift for the logout request validation process to allow a clock drift when checking dates with
Or :relax_signature_validation to accept signatures if no idp certificate registered on settings

@raise [ArgumentError] If Request is nil

# File lib/onelogin/ruby-saml/slo_logoutrequest.rb, line 33
def initialize(request, options = {})
  raise ArgumentError.new("Request cannot be nil") if request.nil?

  @errors = []
  @options = options
  @soft = true
  unless options[:settings].nil?
    @settings = options[:settings]
    unless @settings.soft.nil?
      @soft = @settings.soft
    end
  end

  @request = decode_raw_saml(request)
  @document = REXML::Document.new(@request)
end