class SAML2::Subject::Confirmation

Attributes

in_response_to[RW]

@return [String, nil]

method[RW]

@see Methods @return [String]

not_before[RW]

@return [Time, nil]

not_on_or_after[RW]

@return [Time, nil]

recipient[RW]

@return [String, nil]

Public Instance Methods

build(builder) click to toggle source

(see Base#build)

# File lib/saml2/subject.rb, line 84
def build(builder)
  builder["saml"].SubjectConfirmation("Method" => method) do |subject_confirmation|
    if in_response_to ||
       recipient ||
       not_before ||
       not_on_or_after
      subject_confirmation["saml"].SubjectConfirmationData do |subject_confirmation_data|
        subject_confirmation_data.parent["NotBefore"] = not_before.iso8601 if not_before
        subject_confirmation_data.parent["NotOnOrAfter"] = not_on_or_after.iso8601 if not_on_or_after
        subject_confirmation_data.parent["Recipient"] = recipient if recipient
        subject_confirmation_data.parent["InResponseTo"] = in_response_to if in_response_to
      end
    end
  end
end
from_xml(node) click to toggle source

(see Base#from_xml)

Calls superclass method SAML2::Base::from_xml
# File lib/saml2/subject.rb, line 71
def from_xml(node)
  super
  self.method = node["Method"]
  confirmation_data = node.at_xpath("saml:SubjectConfirmationData", Namespaces::ALL)
  return unless confirmation_data

  self.not_before = Time.parse(confirmation_data["NotBefore"]) if confirmation_data["NotBefore"]
  self.not_on_or_after = Time.parse(confirmation_data["NotOnOrAfter"]) if confirmation_data["NotOnOrAfter"]
  self.recipient = confirmation_data["Recipient"]
  self.in_response_to = confirmation_data["InResponseTo"]
end