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
55
# File 'lib/saml2/entity.rb', line 50

def initialize
  super
  @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)


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

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)


74
75
76
# File 'lib/saml2/entity.rb', line 74

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

#valid_schema?Boolean

If the XML is valid according to SAML XSDs.

Returns:

  • (Boolean)


69
70
71
# File 'lib/saml2/entity.rb', line 69

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

#valid_untilTime?

Returns:

  • (Time, nil)


79
80
81
82
83
84
# File 'lib/saml2/entity.rb', line 79

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