Class: SAML2::Assertion
Instance Attribute Summary collapse
Attributes inherited from Message
#destination, #errors, #issuer
Attributes inherited from Base
Instance Method Summary collapse
- #attribute_statements ⇒ Array<AttributeStatement>
-
#authn_statements ⇒ Array<AuthnStatement]
Array<AuthnStatement].
-
#build(builder) ⇒ void
Serialize this object to XML, as part of a larger document.
- #conditions ⇒ Conditions
- #from_xml(node) ⇒ Object
-
#initialize ⇒ Assertion
constructor
A new instance of Assertion.
Methods inherited from Message
from_xml, #id, #issue_instant, parse, #sign, #valid_schema?, #validate
Methods included from Signable
#sign, #signature, #signed?, #signing_key, #valid_signature?, #validate_signature
Methods inherited from Base
#decrypt, from_xml, #inspect, load_object_array, load_string_array, lookup_qname, #to_s, #to_xml
Constructor Details
#initialize ⇒ Assertion
Returns a new instance of Assertion.
9 10 11 12 13 |
# File 'lib/saml2/assertion.rb', line 9 def initialize super @statements = [] @conditions = Conditions.new end |
Instance Attribute Details
#statements ⇒ Array<AuthnStatement, AttributeStatement>
48 49 50 |
# File 'lib/saml2/assertion.rb', line 48 def statements @statements ||= load_object_array(xml, "saml:AuthnStatement|saml:AttributeStatement") end |
#subject ⇒ Subject?
22 23 24 25 26 27 |
# File 'lib/saml2/assertion.rb', line 22 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
#attribute_statements ⇒ Array<AttributeStatement>
43 44 45 |
# File 'lib/saml2/assertion.rb', line 43 def attribute_statements statements.select { |s| s.is_a?(AttributeStatement) } end |
#authn_statements ⇒ Array<AuthnStatement]
Returns Array<AuthnStatement].
38 39 40 |
# File 'lib/saml2/assertion.rb', line 38 def authn_statements statements.select { |s| s.is_a?(AuthnStatement) } end |
#build(builder) ⇒ void
This method returns an undefined value.
Serialize this object to XML, as part of a larger document
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/saml2/assertion.rb', line 53 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 |
#conditions ⇒ Conditions
30 31 32 33 34 35 |
# File 'lib/saml2/assertion.rb', line 30 def conditions if !instance_variable_defined?(:@conditions) && xml @conditions = Conditions.from_xml(xml.at_xpath("saml:Conditions", Namespaces::ALL)) end @conditions end |
#from_xml(node) ⇒ Object
15 16 17 18 19 |
# File 'lib/saml2/assertion.rb', line 15 def from_xml(node) super @statements = nil remove_instance_variable(:@conditions) end |