Shin.Attributes (Shin v0.2.0) View Source

Queries a Shibboleth IdP for attributes similar to the those sent to the specified SP for a user.

Other functions in this module act as getters to retrieve information from the map.

If your IdP is using another IdP as a proxy then any attributes derived from the upstream IdP will be missing: only attributes sourced or created by the Shibboleth IdP can be returned.

Link to this section Summary

Functions

Returns a map of attribute friendly-names and values, taken from the attribute query results.

Returns a list of all attribute friendly-names in the query results.

Returns the principal/username when passed attribute query results.

Looks up attributes likely to be released to the specified SP for the specified user, returning them as a map in a result tuple.

Looks up attributes likely to be released to the specified SP for the specified user, returning them as a map.

Returns the entityID of the SP that is supposedly "requesting" the attributes

Returns the entityID of the SP that is supposedly "requesting" the attributes

Returns the principal/username when passed attribute query results.

Returns the values of the specified attribute in the query results.

Link to this section Functions

Specs

attributes(results :: map()) :: map()

Returns a map of attribute friendly-names and values, taken from the attribute query results.

(Friendly names are the LDAP-style, relatively human-friendly names of SAML attributes, rather than their URIs)

Examples

    attributes = Shin.Attributes.attributes(query_results)

Specs

names(results :: map()) :: list()

Returns a list of all attribute friendly-names in the query results.

(Friendly names are the LDAP-style, relatively human-friendly names of SAML attributes, rather than their URIs)

Examples

  {:ok, report} = Shin.Attributes.names(query_results)

Specs

principal(results :: map()) :: binary()

Returns the principal/username when passed attribute query results.

(This is identical to username/1)

Examples

  "pete" = Shin.Attributes.principal(query_results)
Link to this function

query(idp, sp, username, options \\ [])

View Source

Specs

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

Looks up attributes likely to be released to the specified SP for the specified user, returning them as a map in a result tuple.

Examples

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

query!(idp, sp, username, options \\ [])

View Source

Specs

query!(
  idp :: Shin.IdP.t(),
  sp :: binary(),
  username :: binary(),
  options :: keyword()
) :: map()

Looks up attributes likely to be released to the specified SP for the specified user, returning them as a map.

Examples

  query_results = Shin.Attributes.query!(idp, "https://test.ukfederation.org.uk/entity", "pete")

Specs

requester(results :: map()) :: binary()

Returns the entityID of the SP that is supposedly "requesting" the attributes

(This is the same as sp/1)

Examples

      "https://test.ukfederation.org.uk/entity" = Shin.Attributes.requester(query_results)

Specs

sp(results :: map()) :: binary()

Returns the entityID of the SP that is supposedly "requesting" the attributes

(This is the same as requester/1)

Examples

      "https://test.ukfederation.org.uk/entity" = Shin.Attributes.sp(query_results)

Specs

username(results :: map()) :: binary()

Returns the principal/username when passed attribute query results.

(This is identical to principal/1)

Examples

  "pete" = Shin.Attributes.username(query_results)
Link to this function

values(results, attribute_name)

View Source

Specs

values(results :: map(), attribute_name :: binary()) :: list()

Returns the values of the specified attribute in the query results.

Examples

    ["urn:mace:dir:entitlement:common-lib-terms"] = Shin.Attributes.values(attr_data, "eduPersonEntitlement")