SmeeView.EntityAttributes (SmeeView v0.1.0) View Source
This module can extracts the <mdattr:EntityAttributes>
elements in entity metadata as "aspect" structs, and then
process and filter the results.
Aspects can be extracted with three functions:
- Views, via
view/3
are lists of aspects - Prisms, via
prism/3
are maps of entity IDs to views - There is also
view_one/3
which returns the first aspect found
Aspects can be extracted from Smee.Metadata
structs, Smee.Entity
structs, or lists of aspects, Metadata and Entity
structs.
The other functions in this module are intended to be applied to collections of aspect structs - for working with individual aspects, please look at the appropriate Aspect module.
Link to this section Summary
Functions
Lists the values for urn:oasis:names:tc:SAML:attribute:assurance-certification
entity attributes
Returns true if any of the attributes contains the entity category
Returns true if any of the attributes indicate CoCo (Code of Conduct) status
Returns true if the aspects contain the specified attribute name
Returns true if the aspects contain the specified attribute type/name and value
Lists all values for entity category (http://macedir.org/entity-category
) entity attributes
Returns true if any of the attributes indicate Hide From Discovery status
Removes any non-IdP aspects from a list (view) or map (prism)
Returns a list of all attribute names.
Returns a map of Elixir.SmeeView.Aspects.EntityAttribute
aspect structs extracted from the input data, with entity IDs as keys.
Returns true if any of the attributes indicate Research And Scholarship status
Lists all nameid types marked as required with the urn:oasis:names:tc:SAML:profiles:subject-id:req
attribute
Returns true if any of the attributes indicate SIRTFI status
Removes any non-SP aspects from a list (view) or map (prism)
Returns true if any of the attributes show support for the specified entity category
Lists all values for entity category support attributes (http://macedir.org/entity-category-support
)
Returns a list of all attribute values - every value for every attribute.
Lists all attribute values for the specified attribute name
Returns a list of Elixir.SmeeView.Aspects.EntityAttribute
aspect structs extracted from the input data.
Returns a single Elixir.SmeeView.Aspects.EntityAttribute
aspect struct extracted from one record in the input data.
Link to this section Functions
Specs
Lists the values for urn:oasis:names:tc:SAML:attribute:assurance-certification
entity attributes
SmeeView.EntityAttributes.assurance_certifications(ent_attrs)
# => ["http://refeds.org/sirtfi", "http://www.swamid.se/policy/assurance/al1",
# "https://refeds.org/sirtfi2"]
Specs
Returns true if any of the attributes contains the entity category
SmeeView.EntityAttributes.category?(ent_attrs, "https://myacademicid.org/entity-categories/esi")
# => false
Specs
Returns true if any of the attributes indicate CoCo (Code of Conduct) status
SmeeView.EntityAttributes.coco?(ent_attrs)
# => true
Specs
Returns true if the aspects contain the specified attribute name
SmeeView.EntityAttributes.contain?(ent_attrs, "urn:oasis:names:tc:SAML:attribute:assurance-certification")
# => true
Specs
Returns true if the aspects contain the specified attribute type/name and value
SmeeView.EntityAttributes.contain?(ent_attrs, "urn:oasis:names:tc:SAML:attribute:assurance-certification", "https://refeds.org/sirtfi2")
# => true
Specs
Lists all values for entity category (http://macedir.org/entity-category
) entity attributes
SmeeView.EntityAttributes.entity_categories(ent_attrs)
# => ["http://aai.dfn.de/category/bwidm-member",
# "http://eduid.cz/uri/idp-group/university",
# "http://refeds.org/category/hide-from-discovery",
# "http://refeds.org/category/research-and-scholarship",
# "http://www.geant.net/uri/dataprotection-code-of-conduct/v1",
# "https://edugate.heanet.ie/rr3/p/page/HEAnetInternalEC",
# "https://federation.renater.fr/category/collaboratif",
# "https://myacademicid.org/entity-categories/esi",
# "https://refeds.org/category/anonymous",
# "https://refeds.org/category/code-of-conduct/v2",
# "https://refeds.org/category/hide-from-discovery",
# "https://refeds.org/category/personalized",
# ... ]
Specs
Returns true if any of the attributes indicate Hide From Discovery status
SmeeView.EntityAttributes.hide?(ent_attrs)
# => true
Specs
Removes any non-IdP aspects from a list (view) or map (prism)
EntityAttributes.idp_filter(view)
# => []
Specs
Returns a list of all attribute names.
The results are sorted and each value is unique.
SmeeView.EntityAttributes.names(ent_attrs)
# => ["http://kafe.kreonet.net/jurisdiction", "http://macedir.org/entity-category",
# "http://macedir.org/entity-category-support",
# "https://federation.renater.fr/member-of",
# "urn:oasis:names:tc:SAML:attribute:assurance-certification",
# "urn:oasis:names:tc:SAML:profiles:subject-id:req",
# "urn:oid:2.16.756.1.2.5.1.1.4", "urn:oid:2.16.756.1.2.5.1.1.5"]
Specs
prism( various :: Smee.Entity.t() | Smee.Metadata.t() | list(), role :: atom(), options :: keyword() ) :: map()
Returns a map of Elixir.SmeeView.Aspects.EntityAttribute
aspect structs extracted from the input data, with entity IDs as keys.
Input data can be a Smee.Entity
or Smee.Metadata
struct, or a list containing Smee.Entity
and/or Smee.Metadata
structs.
Only appropriate aspect records will be returned.
prism/3
is useful for extracting specific types of aspects from lists of entity records, or metadata. If you are
only interested in one aspect from a single Smee.Entity
struct then you should probably use view/3
instead.
The optional role parameter will optimize the results to only search for either :idp or :sp aspects. The default is :all.
EntityAttributes.prism(entity)
# => %{"https://example.com/shibboleth" => [%Elixir.SmeeView.Aspects.EntityAttribute{}, %Elixir.SmeeView.Aspects.EntityAttribute{},]}
Specs
Returns true if any of the attributes indicate Research And Scholarship status
SmeeView.EntityAttributes.ras?(ent_attrs)
# => true
Specs
Lists all nameid types marked as required with the urn:oasis:names:tc:SAML:profiles:subject-id:req
attribute
SmeeView.EntityAttributes.required_subject_ids(ent_attrs)
# => ["pairwise-id", "subject-id"]
Specs
Returns true if any of the attributes indicate SIRTFI status
SmeeView.EntityAttributes.sirtfi?(ent_attrs)
# => false
Specs
Removes any non-SP aspects from a list (view) or map (prism)
EntityAttributes.sp_filter(view)
# => []
Specs
Returns true if any of the attributes show support for the specified entity category
SmeeView.EntityAttributes.supports?(ent_attrs, "https://refeds.org/category/anonymous")
# => false
Specs
Lists all values for entity category support attributes (http://macedir.org/entity-category-support
)
SmeeView.EntityAttributes.supports_entity_categories(ent_attrs)
# => ["http://clarin.eu/category/clarin-member",
# "http://refeds.org/category/research-and-scholarship",
# "http://www.geant.net/uri/dataprotection-code-of-conduct/v1",
# "https://idp.lit.ie/saml2", "https://login.dcu.ie",
# "https://myacademicid.org/entity-categories/esi",
# "https://refeds.org/category/anonymous",
# "https://refeds.org/category/code-of-conduct/v2",
# "https://refeds.org/category/personalized", "https://refeds.org/sirtfi"]
Specs
Returns a list of all attribute values - every value for every attribute.
The results are sorted and each value is unique.
SmeeView.EntityAttributes.values(ent_attrs)
# => ["KR", "any", "hospital", "http://aai.dfn.de/category/bwidm-member",
# "http://aai.dfn.de/category/campus-lsa-member",
# "http://clarin.eu/category/clarin-member", "http://eduid.cz/uri/group/mefanet",
# "http://refeds.org/category/hide-from-discovery",
# "http://refeds.org/category/research-and-scholarship", ...]
Specs
Lists all attribute values for the specified attribute name
The results are sorted and each value is unique.
SmeeView.EntityAttributes.values_for(ent_attrs, "urn:oasis:names:tc:SAML:attribute:assurance-certification")
# => ["http://refeds.org/sirtfi", "http://www.swamid.se/policy/assurance/al1",
# "https://refeds.org/sirtfi", "https://refeds.org/sirtfi2"]
Specs
view( list :: Smee.Entity.t() | Smee.Metadata.t() | list(), role :: atom(), options :: keyword() ) :: list()
Returns a list of Elixir.SmeeView.Aspects.EntityAttribute
aspect structs extracted from the input data.
Input data can be a Smee.Entity
or Smee.Metadata
struct, or a list containing Smee.Entity
, Smee.Metadata
or
any aspects. Only appropriate aspect records will be returned.
view/3
is useful for extracting specific types of aspects from one Entity, but because it has no entity ID information
it's often not the best choice for handling Metadata. When extracting information from entire metadata it's often
better to use prism/3
which returns the same data in a map, associated with each entity's ID.
The optional role parameter will optimize the results to only search for either :idp or :sp aspects. The default is :all.
EntityAttributes.view(entity)
# => [%Elixir.SmeeView.Aspects.EntityAttribute{}, %Elixir.SmeeView.Aspects.EntityAttribute{}]
Specs
view_one( list :: Smee.Entity.t() | Smee.Metadata.t() | list(), role :: atom(), options :: keyword() ) :: SmeeView.Aspects.EntityAttribute.t() | nil
Returns a single Elixir.SmeeView.Aspects.EntityAttribute
aspect struct extracted from one record in the input data.
Input data can be a Smee.Entity
or Smee.Metadata
struct, or a list containing Smee.Entity
, Smee.Metadata
or
any aspects.
Only one entity will be processed and then only one aspect will be returned. If you pass one Entity struct as the input, it will be that entity (obviously). If you pass metadata structs or lists one entity will be chosen at random. The first suitable entity will be returned.
view_one/3
is intended for use with a single entity record and aspects like SmeeView.Aspect.Entity
,
SmeeView.Aspect.SP' or
SmeeView.Aspect.Organization' but will work with any aspect.
The optional role parameter will optimize the results to only search for either :idp or :sp aspects. The default is :all.
EntityAttributes.view_one(entity)
# => %Elixir.SmeeView.Aspects.EntityAttribute{}