# `ExSaml.State.Store`
[🔗](https://github.com/docJerem/ex_saml/blob/main/lib/ex_saml/state/store.ex#L1)

Specification for ExSaml state stores.

# `assertion_key`

```elixir
@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`

```elixir
@type idp_id() :: binary()
```

IdP identifier associated with the assertion.

# `name_id`

```elixir
@type name_id() :: binary()
```

SAML `nameid` returned by IdP.

# `opts`

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

Options passed during the store initialization.

# `delete_assertion`

```elixir
@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`

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

Returns a ExSaml assertion if present in the store.

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

# `init`

```elixir
@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`

```elixir
@callback put_assertion(Plug.Conn.t(), assertion_key(), ExSaml.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.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
