Smee Live Introduction
Mix.install(
[{:smee, ">= 0.4.1"}, {:smee_view, ">= 0.2.1"}, {:smee_feds, ">= 0.3.1"}, {:rambo, "~> 0.3.4"}, {:kino, "~>0.12"}]
)
alias Smee.{Metadata, Entity, Source, MDQ}
What is this?
Smee is a pragmatic library for handling SAML metadata with Elixir, Erlang or any other BEAM language. LiveBook is a web application that automates code & data workflows with interactive notebooks. Docker lets you run applications neatly packaged up with all their requirements.
SmeeLive is a customised Docker container running LiveBook, with all the extra software needed by Smee already installed, and a set of demonstration notebooks that hopefully show off various features of Smee.
The requirements for Smee (xmlsec1, xmllint and xsltproc) have already been installed on this container - if you’re running these notebooks on another installation of Livebook you’ll need to make sure they’re available.
Please click the little play button above a snippet to run the code. These notebooks are fully editable, so feel free to change the code or add new snippets!
A quick example
This snippet will use Smee to download data for CERN’s IdP from the UK Access Management Federation’s MDQ service, and
store it in a variable called cern_idp
as a Smee Entity struct.
cern_idp =
MDQ.source("http://mdq.ukfederation.org.uk/")
|> MDQ.lookup!("https://cern.ch/login")
This snippet will then extract details of entity attributes from the entity using SmeeView
SmeeView.EntityAttributes.view(cern_idp)
By default LiveBook will show a summary of the raw Elixir output from the code snippets. Let’s try piping that into a Kino function to show it as a nice table:
cern_idp
|> SmeeView.EntityAttributes.view()
|> Kino.DataTable.new()
Open the other notebooks for more examples
Click on the open button to see other notebooks included with this container:
-
smee.livemd
Examples using the basic Smee package for downloading and processing metadata XML -
smee_feds.livemd
Examples that use the example federation database in SmeeFeds -
smee_view.livemd
Examples for the SmeeView package, extracting data (like logos, text, attributes) from metadata
More information
- Kino can be used to present results
- LiveBook has a huge amount of documentation inside it - click on Home or the logo to return to the homepage
- The LiveBook website has more information on customising LiveBook and using it with Docker
- Documentation for Smee is available inside this Livebook (hover over the examples!) but also at HexDocs
The Smee libraries are normal Elixir packages and do not require LiveBook - you can use them to build scripts and apps. You can read more about installing Elixir here
LiveBook is best installed directly onto your computer!