samly v0.10.1 Samly View Source
Elixir library used to enable SAML SP SSO to a Phoenix/Plug based application.
Link to this section Summary
Functions
Returns authenticated user SAML Assertion
Returns value of the specified attribute name in the given SAML Assertion
Link to this section Functions
Link to this function
get_active_assertion(conn)
View Source
get_active_assertion(Plug.Conn.t()) :: Samly.Assertion.t() | nil
Returns authenticated user SAML Assertion.
The struct includes the attributes sent from IdP as well as any corresponding locally
computed/derived attributes. Returns nil
if the current Plug session
is not authenticated.
Parameters
conn
- Plug connection
Examples
# When there is an authenticated SAML assertion
%Assertion{} = Samly.get_active_assertion()
Link to this function
get_attribute(assertion, name)
View Source
get_attribute(nil | Samly.Assertion.t(), String.t()) :: nil | String.t()
Returns value of the specified attribute name in the given SAML Assertion.
Checks for the attribute in computed
map first and attributes
map next.
Returns nil
if attribute is not present.
Parameters
assertion
- SAML assertion obtained by callingget_active_assertion/1
name
: Attribute name
Examples
assertion = Samly.get_active_assertion()
computed_fullname = Samly.get_attribute(assertion, "fullname")