Class: RSAML::Advice

Inherits:
Object
  • Object
show all
Includes:
Validatable
Defined in:
lib/rsaml/advice.rb

Overview

Contains any additional information that the SAML authority wishes to provide. This information MAY be ignored by applications without affecting either the semantics or the validity of the assertion.

Instance Attribute Summary

Attributes included from Validatable

#verbose

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Validatable

#valid?

Class Method Details

.from_xml(element) ⇒ Object

Construct an Advice instance from the given XML Element or fragment



25
26
27
28
29
30
31
32
# File 'lib/rsaml/advice.rb', line 25

def self.from_xml(element)
  element = REXML::Document.new(element).root if element.is_a?(String)
  advice = Advice.new
  element.get_elements('saml:Assertion').each do |assertion_element|
    advice.assertions << Assertion.from_xml(assertion_element)
  end
  advice
end

Instance Method Details

#assertionsObject

Contains a mixture of zero or more Assertion, EncryptedAssertion, assertion IDs, and assertion URIs. May also contain custom objects that produce namespace-qualified XML for non-SAML elements.



8
9
10
# File 'lib/rsaml/advice.rb', line 8

def assertions
  @assertions ||= []
end

#to_xml(xml = Builder::XmlMarkup.new) ⇒ Object

Construct an XML fragment representing the assertion



18
19
20
21
22
# File 'lib/rsaml/advice.rb', line 18

def to_xml(xml=Builder::XmlMarkup.new)
  xml.tag!('saml:Advice') {
    assertions.each { |assertion| xml << assertion.to_xml }
  }
end

#validateObject

Validate the advice structure.



13
14
15
# File 'lib/rsaml/advice.rb', line 13

def validate
  assertions.each { |assertion| assertion.validate }
end