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
# 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']
    @root.set_id_attribute('ID')
    @signature = nil unless signed_node == "##{@root['ID']}"
  end
  @signature
end

#signed?Boolean

Returns:

  • (Boolean)


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

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)


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

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

#valid_untilObject



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

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