Class: SAML2::Subject::Confirmation

Inherits:
Base
  • Object
show all
Defined in:
lib/saml2/subject.rb

Defined Under Namespace

Modules: Methods

Instance Attribute Summary collapse

Attributes inherited from Base

#xml

Instance Method Summary collapse

Methods inherited from Base

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

Instance Attribute Details

#in_response_toObject

Returns the value of attribute in_response_to.



53
54
55
# File 'lib/saml2/subject.rb', line 53

def in_response_to
  @in_response_to
end

#methodObject

Returns the value of attribute method.



53
54
55
# File 'lib/saml2/subject.rb', line 53

def method
  @method
end

#not_beforeObject

Returns the value of attribute not_before.



53
54
55
# File 'lib/saml2/subject.rb', line 53

def not_before
  @not_before
end

#not_on_or_afterObject

Returns the value of attribute not_on_or_after.



53
54
55
# File 'lib/saml2/subject.rb', line 53

def not_on_or_after
  @not_on_or_after
end

#recipientObject

Returns the value of attribute recipient.



53
54
55
# File 'lib/saml2/subject.rb', line 53

def recipient
  @recipient
end

Instance Method Details

#build(builder) ⇒ Object



67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/saml2/subject.rb', line 67

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) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
# File 'lib/saml2/subject.rb', line 55

def from_xml(node)
  super
  self.method = node['Method']
  confirmation_data = node.at_xpath('saml:SubjectConfirmationData', Namespaces::ALL)
  if 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
end