Class: SAML2::Entity::Group

Inherits:
Base
  • Object
show all
Includes:
Enumerable, Signable
Defined in:
lib/saml2/entity.rb

Instance Attribute Summary

Attributes inherited from Base

#xml

Instance Method Summary collapse

Methods included from Signable

#sign, #signature, #signed?, #signing_key, #valid_signature?, #validate_signature

Methods inherited from Base

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

Constructor Details

#initializeGroup

Returns a new instance of Group.


50
51
52
53
54
# File 'lib/saml2/entity.rb', line 50

def initialize
  @entities = []
  @id = "_#{SecureRandom.uuid}"
  @valid_until = nil
end

Instance Method Details

#from_xml(node) ⇒ void

This method returns an undefined value.

Parse an XML element into this object.

Parameters:

  • node (Nokogiri::XML::Element)

57
58
59
60
61
62
63
64
# File 'lib/saml2/entity.rb', line 57

def from_xml(node)
  super
  @id = nil
  remove_instance_variable(:@valid_until)
  @entities = Base.load_object_array(xml, "md:EntityDescriptor|md:EntitiesDescriptor",
          'EntityDescriptor' => Entity,
          'EntitiesDescriptor' => Group)
end

#idString

Returns:

  • (String)

72
73
74
# File 'lib/saml2/entity.rb', line 72

def id
  @id ||= xml['ID']
end

#valid_schema?Boolean

If the XML is valid according to SAML XSDs.

Returns:

  • (Boolean)

67
68
69
# File 'lib/saml2/entity.rb', line 67

def valid_schema?
  Schemas..valid?(xml.document)
end

#valid_untilTime?

Returns:

  • (Time, nil)

77
78
79
80
81
82
# File 'lib/saml2/entity.rb', line 77

def valid_until
  unless instance_variable_defined?(:@valid_until)
    @valid_until = xml['validUntil'] && Time.parse(xml['validUntil'])
  end
  @valid_until
end