SmeeView.Scopes (SmeeView v0.1.0) View Source
This module can extracts the <shibmd:Scope>
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
Removes any non-IdP aspects from a list (view) or map (prism)
Returns a map of Elixir.SmeeView.Aspects.Scope
aspect structs extracted from the input data, with entity IDs as keys.
Removes any non-SP aspects from a list (view) or map (prism)
Returns a list of Elixir.SmeeView.Aspects.Scope
aspect structs extracted from the input data.
Returns a single Elixir.SmeeView.Aspects.Scope
aspect struct extracted from one record in the input data.
Link to this section Functions
Specs
Removes any non-IdP aspects from a list (view) or map (prism)
Scopes.idp_filter(view)
# => []
Specs
prism( various :: Smee.Entity.t() | Smee.Metadata.t() | list(), role :: atom(), options :: keyword() ) :: map()
Returns a map of Elixir.SmeeView.Aspects.Scope
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.
Scopes.prism(entity)
# => %{"https://example.com/shibboleth" => [%Elixir.SmeeView.Aspects.Scope{}, %Elixir.SmeeView.Aspects.Scope{},]}
Specs
Removes any non-SP aspects from a list (view) or map (prism)
Scopes.sp_filter(view)
# => []
Specs
view( list :: Smee.Entity.t() | Smee.Metadata.t() | list(), role :: atom(), options :: keyword() ) :: list()
Returns a list of Elixir.SmeeView.Aspects.Scope
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.
Scopes.view(entity)
# => [%Elixir.SmeeView.Aspects.Scope{}, %Elixir.SmeeView.Aspects.Scope{}]
Specs
view_one( list :: Smee.Entity.t() | Smee.Metadata.t() | list(), role :: atom(), options :: keyword() ) :: SmeeView.Aspects.Scope.t() | nil
Returns a single Elixir.SmeeView.Aspects.Scope
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.
Scopes.view_one(entity)
# => %Elixir.SmeeView.Aspects.Scope{}