Samly.State.Store behaviour (samly v1.0.0)

View Source

Specification for Samly state stores.

Summary

Types

The name_id should not be used independent of the idp_id. It is within the scope of idp_id. Together these form the assertion key.

IdP identifier associated with the assertion.

SAML nameid returned by IdP.

Options passed during the store initialization.

Callbacks

Removes the given SAML assertion from the store.

Returns a Samly assertion if present in the store.

Initializes the store.

Saves the given SAML assertion in the store.

Types

assertion_key()

@type assertion_key() :: {idp_id(), name_id()}

The name_id should not be used independent of the idp_id. It is within the scope of idp_id. Together these form the assertion key.

idp_id()

@type idp_id() :: binary()

IdP identifier associated with the assertion.

name_id()

@type name_id() :: binary()

SAML nameid returned by IdP.

opts()

@type opts() :: Plug.opts()

Options passed during the store initialization.

Callbacks

delete_assertion(t, assertion_key, opts)

@callback delete_assertion(Plug.Conn.t(), assertion_key(), opts()) ::
  Plug.Conn.t() | no_return()

Removes the given SAML assertion from the store.

May raise an error if there is a failure. An authenticated session must be terminated after calling this.

get_assertion(t, assertion_key, opts)

@callback get_assertion(Plug.Conn.t(), assertion_key(), opts()) ::
  Samly.Assertion.t() | nil

Returns a Samly assertion if present in the store.

Returns nil if the assertion for the given key is not present in the store.

init(opts)

@callback init(opts()) :: opts() | no_return()

Initializes the store.

The options returned from this function will be given to get_assertion/3, put_assertion/4 and delete_assertion/3.

put_assertion(t, assertion_key, t, opts)

@callback put_assertion(Plug.Conn.t(), assertion_key(), Samly.Assertion.t(), opts()) ::
  Plug.Conn.t() | no_return()

Saves the given SAML assertion in the store.

May raise an error if there is a failure. An authenticated session should not be established in that case.