Class: SAML2::Entity::Group

Inherits:
Array
  • Object
show all
Defined in:
lib/saml2/entity.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGroup

Returns a new instance of Group.



34
35
36
# File 'lib/saml2/entity.rb', line 34

def initialize
  @valid_until = nil
end

Class Method Details

.from_xml(node) ⇒ Object



30
31
32
# File 'lib/saml2/entity.rb', line 30

def self.from_xml(node)
  node && new.from_xml(node)
end

Instance Method Details

#from_xml(node) ⇒ Object



38
39
40
41
42
43
44
# File 'lib/saml2/entity.rb', line 38

def from_xml(node)
  @root = node
  remove_instance_variable(:@valid_until)
  replace(Base.load_object_array(@root, "md:EntityDescriptor|md:EntitiesDescriptor",
          'EntityDescriptor' => Entity,
          'EntitiesDescriptor' => Group))
end

#signatureObject



50
51
52
53
54
55
56
57
58
59
# File 'lib/saml2/entity.rb', line 50

def signature
  unless instance_variable_defined?(:@signature)
    @signature = @root.at_xpath('dsig:Signature', Namespaces::ALL)
    signed_node = @signature.at_xpath('dsig:SignedInfo/dsig:Reference', Namespaces::ALL)['URI']
    # validating the schema will automatically add ID attributes, so check that first
    @root.set_id_attribute('ID') unless @root.document.get_id(@root['ID'])
    @signature = nil unless signed_node == "##{@root['ID']}"
  end
  @signature
end

#signed?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/saml2/entity.rb', line 61

def signed?
  !!signature
end

#valid_schema?Boolean

Returns:

  • (Boolean)


46
47
48
# File 'lib/saml2/entity.rb', line 46

def valid_schema?
  Schemas.federation.valid?(@root.document)
end

#valid_signature?(*args) ⇒ Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/saml2/entity.rb', line 65

def valid_signature?(*args)
  signature.verify_with(*args)
end

#valid_untilObject



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

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