Class: SAML2::Assertion

Inherits:
Message show all
Defined in:
lib/saml2/assertion.rb

Instance Attribute Summary collapse

Attributes inherited from Message

#destination, #issuer

Attributes inherited from Base

#xml

Instance Method Summary collapse

Methods inherited from Message

from_xml, #id, inherited, #issue_instant, parse, #sign, #valid_schema?, #validate_signature

Methods included from Signable

#sign, #signature, #signed?, #signing_key, #valid_signature?, #validate_signature

Methods inherited from Base

from_xml, #inspect, load_object_array, load_string_array, lookup_qname, #to_s, #to_xml

Constructor Details

#initializeAssertion

Returns a new instance of Assertion.



7
8
9
10
11
# File 'lib/saml2/assertion.rb', line 7

def initialize
  super
  @statements = []
  @conditions = Conditions.new
end

Instance Attribute Details

#statementsObject



30
31
32
# File 'lib/saml2/assertion.rb', line 30

def statements
  @statements ||= load_object_array(xml, 'saml:AuthnStatement|saml:AttributeStatement')
end

#subjectObject



19
20
21
22
23
24
# File 'lib/saml2/assertion.rb', line 19

def subject
  if xml && !instance_variable_defined?(:@subject)
    @subject = Subject.from_xml(xml.at_xpath('saml:Subject', Namespaces::ALL))
  end
  @subject
end

Instance Method Details

#build(builder) ⇒ Object



34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'lib/saml2/assertion.rb', line 34

def build(builder)
  builder['saml'].Assertion(
      'xmlns:saml' => Namespaces::SAML
  ) do |assertion|
    super(assertion)

    subject.build(assertion)

    conditions.build(assertion)

    statements.each { |stmt| stmt.build(assertion) }
  end
end

#conditionsObject



26
27
28
# File 'lib/saml2/assertion.rb', line 26

def conditions
  @conditions ||= Conditions.from_xml(xml.at_xpath('saml:Conditions', Namespaces::ALL))
end

#from_xml(node) ⇒ Object



13
14
15
16
17
# File 'lib/saml2/assertion.rb', line 13

def from_xml(node)
  super
  @conditions = nil
  @statements = nil
end