View Source SmeeFeds (SmeeFeds v0.3.1)

SmeeFeds is a SAML federation data management extension to Smee for use in research, testing and development.

Smee has tools for handling the sources of SAML metadata but nothing to represent the publishers of metadata. SmeeFeds adds a few tools for handling federations and includes a large collection of information about research and education federations.

Features

  • Easily find information on National Research and Education organisation (NREN) federations.
  • Filter and group federations by location, type, structure and tags.
  • Use federation records directly with Smee to download metadata from aggregates or MDQ servers
  • Export lists of federation information as CSV, JSON or Markdown documents
  • Manage and load federation data into your applications

The top level SmeeFeds module has tools for selecting individual federation details or lists of many at once. SmeeFeds contain more tools for handling federations, such as:

  • SmeeFeds.Federation - tools for accessing data such as metadata download URLs, contacts, homepages, and so on.
  • SmeeFeds.Export - convert lists of federations into JSON or CSV data for export, or simple text reports
  • SmeeFeds.Import - convert JSON documents into Federation lists
  • SmeeFeds.Filter - filter lists of federations by various criteria

IMPORTANT DISCLAIMER AND WARNING

SmeeFeds comes with a built-in list of federations, using information gathered from various sources on the Internet.

This collection of information is example data for use by researchers, developers and testers.

IT IS NOT FOR USE IN PRODUCTION ENVIRONMENTS

Metadata is the bedrock of trust and information security in SAML federations. DO NOT use metadata URLs, certificates and certificate fingerprints to download and use metadata in live services without confirming each detail yourself.

If you must use SmeeFeds as part of a production service, then after information has been verified you can export only the verified information you need as a JSON file and set it as the new default using :smee_feds, :data_file config setting in your application (if compiled) or set a list of Federations with :smee_feds, :federations at runtime.

There is absolutely no guarantee or warranty that the data in SmeeFeds is correct, and it is not supported by any of the federations listed. It's totally unofficial.

Summary

Functions

Accepts a list of federations, and returns a list of federations with tags automatically added.

Lists all countries in the provided list of federations

Finds a federation in the default database by ID and returns the full federation record.

Returns a list of SmeeFeds.Federation structs from the default collection.

Returns a list of the specified SmeeFeds.Federation structs from the default collection.

Finds a federation in the supplied list by ID and returns the full federation record.

Returns a federation record if one with the specified ID is present in the list, or nil if one can't be found

Lists all ID types in the provided list of federations, as atoms.

Returns the ids of all federations in the provided list of federations as a list of atoms.

Lists all unique protocols in the provided list of federations, as atoms.

Tries to find the federation that published the provided Smee record (source, entity or metadata)

Is a federation the publisher of the provided Smee Source, Metadata, or Entity?

Lists all regions in the provided list of federations

Lists all types of structures in the provided list of federations, as atoms.

Lists all sub_regions in the provided list of federations

Lists all super_regions in the provided list of federations

Lists all unique tags in the provided list of federations, as atoms.

Returns a filtered list of SmeeFeds.Federation structs when passed a list of federations and federation IDs (as atoms) to select.

Lists all federation types in the provided list of federations, as atoms.

Lists all upstream federation IDs in the provided list of federations, as atoms.

Functions

Link to this function

autotag!(federations, options \\ [])

View Source
@spec autotag!(enum :: Enumerable.t(), options :: keyword()) :: Enumerable.t()

Accepts a list of federations, and returns a list of federations with tags automatically added.

Uses Federation.autotag!/2, and works with lists and streams.

Examples

iex> tags = SmeeFeds.federations() |> SmeeFeds.autotag!() |> SmeeFeds.tags()
iex> "mesh" in tags
true
@spec countries(federations :: [SmeeFeds.Federation.t()]) :: [struct()]

Lists all countries in the provided list of federations

Examples

iex> SmeeFeds.federations([:ukamf, :incommon]) |> SmeeFeds.countries()
@spec federation(federation :: atom() | binary()) :: SmeeFeds.Federation.t() | nil

Finds a federation in the default database by ID and returns the full federation record.

Example

iex> incommon = SmeeFeds.federation(:incommon)
iex> incommon.policy
"https://incommon.org/about/policies/"
@spec federations() :: [SmeeFeds.Federation.t()]

Returns a list of SmeeFeds.Federation structs from the default collection.

Returns all known federations from the default collection.

Example

iex> federations = SmeeFeds.federations()
iex> Enum.count(federations)
76
@spec federations(ids :: atom() | [atom() | binary()]) :: [SmeeFeds.Federation.t()]

Returns a list of the specified SmeeFeds.Federation structs from the default collection.

Example

iex> federations = SmeeFeds.federations([:ukamf, :wayf])
iex> Enum.count(federations)
2
@spec get(federations :: list(), id :: atom() | binary()) ::
  SmeeFeds.Federation.t() | nil

Finds a federation in the supplied list by ID and returns the full federation record.

Example

iex> federations = SmeeFeds.federations()
iex> incommon = SmeeFeds.get(federations, :incommon)
iex> incommon.url
"http://incommon.org/"
Link to this function

get_by(federations, id_type, id)

View Source
@spec get_by(
  federations :: [SmeeFeds.Federation.t()],
  id_type :: atom(),
  id :: atom() | binary()
) ::
  SmeeFeds.Federation.t() | nil

Returns a federation record if one with the specified ID is present in the list, or nil if one can't be found

Available IDs can be found using SmeeFeds.id_types/1. Two are built-in: :uri and :smee. Any other ID key used in the alt_ids part of the Federation struct can be searched.

Examples

iex> SmeeFeds.federations() |> SmeeFeds.get_by(:uri, "http://ukfederation.org.uk")
iex> SmeeFeds.federations() |> SmeeFeds.get_by(:edugain,  "HAKA")
@spec id_types(federations :: [SmeeFeds.Federation.t()]) :: [atom()]

Lists all ID types in the provided list of federations, as atoms.

Examples

iex> SmeeFeds.federations() |> SmeeFeds.id_types()
[:edugain, :met, :smee, :uri]
@spec ids(federations :: list()) :: [atom()]

Returns the ids of all federations in the provided list of federations as a list of atoms.

Example

 iex> ids = SmeeFeds.ids(SmeeFeds.federations())
 iex> Enum.slice(ids, 0..3)
 [:aaf, :aaieduhr, :aaiedumk, :aconet]
@spec protocols(federations :: [SmeeFeds.Federation.t()]) :: [atom()]

Lists all unique protocols in the provided list of federations, as atoms.

Examples

iex> SmeeFeds.federations() |> SmeeFeds.protocols()
[:saml2]
Link to this function

publisher(federations, smee_struct)

View Source
@spec publisher(
  federations :: list(),
  smee_struct :: Smee.Source.t() | Smee.Metadata.t() | Smee.Entity.t()
) :: SmeeFeds.Federation.t() | nil

Tries to find the federation that published the provided Smee record (source, entity or metadata)

The first matching federation record will be returned if found, or nil if no federations match.

Example

iex> source = Smee.source("http://metadata.ukfederation.org.uk/ukfederation-metadata.xml")
iex> federations = SmeeFeds.federations()
iex> federation = SmeeFeds.publisher(federations, source)
%SmeeFeds.Federation{id: :ukamf} = federation
Link to this function

publisher?(federation, arg2)

View Source
@spec publisher?(
  SmeeFeds.Federation.t(),
  smee_struct :: Smee.Source.t() | Smee.Metadata.t() | Smee.Entity.t()
) :: boolean()

Is a federation the publisher of the provided Smee Source, Metadata, or Entity?

Returns true if the federation and source, metadata or entity share a URL or publisher URI, false otherwise.

Example

iex> source = Smee.source("http://metadata.ukfederation.org.uk/ukfederation-metadata.xml")
iex> federations = SmeeFeds.federations()
iex> federation = SmeeFeds.get(federations, :ukamf)
iex> SmeeFeds.publisher?(federation, source)
true
@spec regions(federations :: [SmeeFeds.Federation.t()]) :: [struct()]

Lists all regions in the provided list of federations

Examples

iex> SmeeFeds.federations([:ukamf, :incommon]) |> SmeeFeds.regions()
["Americas", "Europe"]
@spec structures(federations :: [SmeeFeds.Federation.t()]) :: [atom()]

Lists all types of structures in the provided list of federations, as atoms.

Examples

iex> SmeeFeds.federations() |> SmeeFeds.structures()
[:has, :mesh]
Link to this function

sub_regions(federations)

View Source
@spec sub_regions(federations :: [SmeeFeds.Federation.t()]) :: [struct()]

Lists all sub_regions in the provided list of federations

Examples

iex> SmeeFeds.federations([:ukamf, :incommon]) |> SmeeFeds.sub_regions()
["Northern America", "Northern Europe"]
Link to this function

super_regions(federations)

View Source
@spec super_regions(federations :: [SmeeFeds.Federation.t()]) :: [struct()]

Lists all super_regions in the provided list of federations

Examples

iex> SmeeFeds.federations([:ukamf, :incommon]) |> SmeeFeds.super_regions()
["AMER", "EMEA"]
@spec tags(federations :: [SmeeFeds.Federation.t()]) :: [atom()]

Lists all unique tags in the provided list of federations, as atoms.

Examples

iex> SmeeFeds.federations() |> SmeeFeds.tags()
["noSlow", "noTest"]
Link to this function

take(federations, federation_ids)

View Source
@spec take(federations :: list(), federation_ids :: [atom()]) :: [
  SmeeFeds.Federation.t()
]

Returns a filtered list of SmeeFeds.Federation structs when passed a list of federations and federation IDs (as atoms) to select.

Example

iex> all_federations = SmeeFeds.federations()
iex> my_federations = SmeeFeds.take(all_federations, [:ukamf, :switch])
iex> Enum.map(my_federations, fn f -> f.name end)
["SWITCHaai", "UK Access Management Federation"]
@spec types(federations :: [SmeeFeds.Federation.t()]) :: [atom()]

Lists all federation types in the provided list of federations, as atoms.

Examples

iex> SmeeFeds.federations() |> SmeeFeds.types()
[:inter, :misc, :nren]
@spec upstream(federations :: [SmeeFeds.Federation.t()]) :: [atom()]

Lists all upstream federation IDs in the provided list of federations, as atoms.

Examples

iex> SmeeFeds.federations() |> SmeeFeds.upstream()
[:edugain]
iex> [%SmeeFeds.Federation{id: :edugain}] =  SmeeFeds.federations |> SmeeFeds.upstream() |> SmeeFeds.federations()