class Shibkit::MetaMeta::Federation

Class to represent a Shibboleth Federation or collection of local metadata

Constants

REQUIRED_QUACKS
ROOT_ELEMENT

Element and attribute used to select XML for new objects

TARGET_ATTR

Attributes

countries[RW]

@return [Array] country codes for areas served by the federation

description[RW]

@return [String] Brief description of the federation or collection

display_name[RW]

The human-readable display name of the Federation or collection of metadata

entities[RW]

Array of entities within the federation or metadata collection

federation_uri[RW]

The URI name of the federation (may be missing for local collections)

groups[RW]
homepage_url[RW]

@return [String] URL of the federation or collection’s home page

languages[RW]

@return [Array] Array of languages supported by the federation or collection

metadata_id[RW]

The unique ID of the federation document (probably time/version based)

name[RW]

@return [String] the full name of the federation or collection

read_at[R]

Time the Federation metadata was parsed

refeds_url[RW]

@return [String, nil] URL of the federation’s Refeds wiki entry

source_file[RW]

Source file for this federation

support_email[RW]

@return [String] Main contact email address for the federation

trustiness[RW]
type[RW]

@return [String] :federation for proper federations, :collection for

simple collections of entities.
uri[RW]

The URI name of the federation (may be missing for local collections)

valid_until[RW]

Expiry date of the published metadata file

Public Instance Methods

idps() click to toggle source
# File lib/shibkit/meta_meta/federation.rb, line 114
def idps
  
  return entities.select { |e| e.idp? }
  
end
sps() click to toggle source
# File lib/shibkit/meta_meta/federation.rb, line 108
def sps
  
  return entities.select { |e| e.sp? }
  
end
tags() click to toggle source
# File lib/shibkit/meta_meta/federation.rb, line 102
def tags
  
  return @tags.nil? ? [] : @tags
  
end
tags=(tags) click to toggle source
# File lib/shibkit/meta_meta/federation.rb, line 92
def tags=(tags)
  
  @tags = [tags].flatten.uniq
  
  if entities and ::Shibkit::MetaMeta.config.auto_tag?
    entities.each { |e| e.tags = e.tags << @tags } unless tags.empty?
  end
  
end
to_s() click to toggle source
# File lib/shibkit/meta_meta/federation.rb, line 85
def to_s
  
  return uri
  
end

Private Instance Methods

parse_xml() click to toggle source

Build a federation object out of metadata XML

# File lib/shibkit/meta_meta/federation.rb, line 132
def parse_xml
  
  self.metadata_id    = @noko['ID'].to_s.strip
  self.federation_uri = @noko['Name'].to_s.strip
  self.valid_until    = @noko['validUntil'].strip
  self.entities       = Array.new
  
  ## Process XML chunk for each entity in turn
  log.info "Building entities for federation (#{uri})..."
  @noko.xpath("//xmlns:EntityDescriptor").each do |ex|
  
    entity = Entity.new(ex)
    entity.primary_federation_uri = self.federation_uri
    
    entity.tags << self.tags
    
    ## Collect this entity in the federation object
    self.entities << entity
    
  end

  log.debug "Derived federation #{self.uri} from XML"

end
select_xml(target=nil, options={}) click to toggle source

Special case for federation top-level nodes

# File lib/shibkit/meta_meta/federation.rb, line 123
def select_xml(target=nil, options={})

  raise "No suitable XML was selected" unless @noko and
    @noko.kind_of?(Nokogiri::XML::Element) and
    @noko.name == ROOT_ELEMENT 

end