Class: SAML2::AuthnStatement

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

Defined Under Namespace

Modules: Classes

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

#authn_context_class_refObject

Returns the value of attribute authn_context_class_ref.



18
19
20
# File 'lib/saml2/authn_statement.rb', line 18

def authn_context_class_ref
  @authn_context_class_ref
end

#authn_instantObject

Returns the value of attribute authn_instant.



18
19
20
# File 'lib/saml2/authn_statement.rb', line 18

def authn_instant
  @authn_instant
end

#session_indexObject

Returns the value of attribute session_index.



18
19
20
# File 'lib/saml2/authn_statement.rb', line 18

def session_index
  @session_index
end

#session_not_on_or_afterObject

Returns the value of attribute session_not_on_or_after.



18
19
20
# File 'lib/saml2/authn_statement.rb', line 18

def session_not_on_or_after
  @session_not_on_or_after
end

Instance Method Details

#build(builder) ⇒ Object



28
29
30
31
32
33
34
35
36
# File 'lib/saml2/authn_statement.rb', line 28

def build(builder)
  builder['saml'].AuthnStatement('AuthnInstant' => authn_instant.iso8601) do |authn_statement|
    authn_statement.parent['SessionIndex'] = session_index if session_index
    authn_statement.parent['SessionNotOnOrAfter'] = session_not_on_or_after.iso8601 if session_not_on_or_after
    authn_statement['saml'].AuthnContext do |authn_context|
      authn_context['saml'].AuthnContextClassRef(authn_context_class_ref) if authn_context_class_ref
    end
  end
end

#from_xml(node) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/saml2/authn_statement.rb', line 20

def from_xml(node)
  super
  @authn_instant = Time.parse(node['AuthnInstant'])
  @session_index = node['SessionIndex']
  @session_not_on_or_after = Time.parse(node['SessionNotOnOrAfter']) if node['SessionNotOnOrAfter']
  @authn_context_class_ref = node.at_xpath('saml:AuthnContext/saml:AuthnContextClassRef', Namespaces::ALL)&.content&.strip
end