Class: RSAML::Subject
- Inherits:
-
Object
- Object
- RSAML::Subject
- Defined in:
- lib/rsaml/subject.rb
Overview
Specifies the principal that is the subject of all of the (zero or more) statements in an assertion.
Instance Attribute Summary collapse
-
#identifier ⇒ Object
The subject identifier.
Class Method Summary collapse
-
.from_xml(element) ⇒ Object
Construct a Subject from an XML Element.
Instance Method Summary collapse
-
#initialize(identifier = nil) ⇒ Subject
constructor
Initialize the subject with the given identifier.
-
#subject_confirmations ⇒ Object
Information that allows the subject to be confirmed.
-
#to_xml(xml = Builder::XmlMarkup.new) ⇒ Object
Construct an XML fragment representing the subject.
Constructor Details
#initialize(identifier = nil) ⇒ Subject
Initialize the subject with the given identifier
10 11 12 |
# File 'lib/rsaml/subject.rb', line 10 def initialize(identifier=nil) @identifier = identifier end |
Instance Attribute Details
#identifier ⇒ Object
The subject identifier
7 8 9 |
# File 'lib/rsaml/subject.rb', line 7 def identifier @identifier end |
Class Method Details
.from_xml(element) ⇒ Object
Construct a Subject from an XML Element.
30 31 32 33 34 35 |
# File 'lib/rsaml/subject.rb', line 30 def self.from_xml(element) element = REXML::Document.new(element).root if element.is_a?(String) element.get_elements('saml:NameID').each do |identifier| return Subject.new(Identifier::Name.from_xml(identifier)) end end |
Instance Method Details
#subject_confirmations ⇒ Object
Information that allows the subject to be confirmed. If more than one subject confirmation is provided, then satisfying any one of them is sufficient to confirm the subject for the purpose of applying the assertion.
17 18 19 |
# File 'lib/rsaml/subject.rb', line 17 def subject_confirmations @subject_confirmations ||= [] end |
#to_xml(xml = Builder::XmlMarkup.new) ⇒ Object
Construct an XML fragment representing the subject
22 23 24 25 26 27 |
# File 'lib/rsaml/subject.rb', line 22 def to_xml(xml=Builder::XmlMarkup.new) xml.tag!('saml:Subject') { xml << identifier.to_xml unless identifier.nil? xml << subject_confirmations.map { |sc| sc.to_xml }.join } end |