Shin.Metadata (Shin v0.2.0) View Source

Queries and reloads metadata at the IdP. Metadata for SAML entities can be downloaded and metadata providers can be reset.

The module can be used to warm metadata caches, force reloads of metadata providers without restarting the IdP, and debug metadata source issues.

Link to this section Summary

Functions

Similar to query3 but no metadata is returned - its purpose is to prime the IdP's cached metadata.

Lists active/known metadata providers at the IdP.

Query the IdP for metadata, returning the XML metadata for the specified entity ID if it can be found by the IdP.

Query the IdP for metadata, returning the XML metadata for the specified entity ID if it can be found by the IdP.

Sends a reload request for the specified metadata provider to the IdP. This should cause the IdP to reset and reload the metadata associated with that provider.

Link to this section Functions

Specs

cache(idp :: Shin.IdP.t(), entity_ids :: binary() | list()) :: list()

Similar to query3 but no metadata is returned - its purpose is to prime the IdP's cached metadata.

The IDs of entities that were actually found and cached will be returned as a list.

Examples

  ["https://test.ukfederation.org.uk/entity"] = Shin.Metadata.cache(idp, "https://test.ukfederation.org.uk/entity")
  ["https://test.ukfederation.org.uk/entity"] = Shin.Metadata.cache(idp, ["https://test.ukfederation.org.uk/entity", "http://example.com/fake"])

Specs

providers(idp :: Shin.IdP.t()) :: list()

Lists active/known metadata providers at the IdP.

Each metadata provider is a source of entity metadata. Shin makes a metrics API query to find them.

Examples

  providers = Shin.Metadata.providers(idp)
Link to this function

query(idp, entity_id, options \\ [])

View Source

Specs

query(idp :: Shin.IdP.t(), entity_id :: binary(), options :: keyword()) ::
  {:ok, binary()} | {:error, binary()}

Query the IdP for metadata, returning the XML metadata for the specified entity ID if it can be found by the IdP.

Metadata is looked up using the IdP's metadata providers, using each one in turn until metadata is found.

The metadata XML is not parsed or validated in any way. If you need that sort of thing please take a look at the Smee library.

Pass the IdP and the entity ID of the SP.

Examples

  {:ok, metadata_xml} = Shin.Metadata.query(idp, "https://test.ukfederation.org.uk/entity")
Link to this function

query!(idp, sentity_id, options \\ [])

View Source

Specs

query!(idp :: Shin.IdP.t(), entity_id :: binary(), options :: keyword()) ::
  binary()

Query the IdP for metadata, returning the XML metadata for the specified entity ID if it can be found by the IdP.

Metadata is looked up using the IdP's metadata providers, using each one in turn until metadata is found.

The metadata XML is not parsed or validated in any way. If you need that sort of thing please take a look at the Smee library.

Pass the IdP and the entity ID of the SP.

Examples

  metadata_xml = Shin.Metadata.query!(idp, "https://test.ukfederation.org.uk/entity")
Link to this function

reload(idp, mdp_id, options \\ [])

View Source

Specs

reload(idp :: Shin.IdP.t(), mdp_id :: binary(), options :: keyword()) ::
  {:ok, binary()} | {:error, binary()}

Sends a reload request for the specified metadata provider to the IdP. This should cause the IdP to reset and reload the metadata associated with that provider.

Pass an IdP as the first parameter. The second parameter must be the provider name. You can list active providers with Metadata.providers/1

Examples

  {:ok, _} = Shin.Metadata.reload(idp, "ukFederationMDQ")