Class: Saml::Kit::Response

Inherits:
Document show all
Extended by:
Forwardable
Includes:
Respondable
Defined in:
lib/saml/kit/response.rb

Overview

This class is responsible for validating and parsing a SAML Response document.

Constant Summary

Constants inherited from Document

Document::CONSTRUCTORS, Document::XPATH

Constants included from XsdValidatable

XsdValidatable::METADATA_XSD, XsdValidatable::PROTOCOL_XSD

Constants included from XmlParseable

XmlParseable::NAMESPACES

Instance Attribute Summary

Attributes included from Respondable

#request_id

Attributes inherited from Document

#name, #registry

Instance Method Summary collapse

Methods included from Respondable

#in_response_to, #status_code, #status_message, #success?

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

#signed?, #trusted?

Methods included from Validatable

#each_error

Constructor Details

#initialize(xml, request_id: nil, configuration: Saml::Kit.configuration) ⇒ Response

Returns a new instance of Response.



17
18
19
20
21
22
23
24
# File 'lib/saml/kit/response.rb', line 17

def initialize(
  xml,
  request_id: nil,
  configuration: Saml::Kit.configuration
)
  @request_id = request_id
  super(xml, name: 'Response', configuration: configuration)
end

Instance Method Details

#assertion(private_keys = configuration.private_keys(use: :encryption)) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/saml/kit/response.rb', line 26

def assertion(private_keys = configuration.private_keys(use: :encryption))
  @assertion ||=
    begin
      node = assertion_nodes.last
      if node.nil?
        Saml::Kit::NullAssertion.new
      else
        Saml::Kit::Assertion.new(
          node,
          configuration: @configuration,
          private_keys: private_keys
        )
      end
    end
end