View Source CsrfPlus.Store.Behaviour behaviour (CsrfPlus v0.1.1)
Defines the behaviour for a store.
Summary
Callbacks
Returns all the accesses in the store.
Deletes an access from the store by its access_id
.
May delete all the tokens in the store that had expired. Other option, is to flag them as expired.
Given an access_id
, returns the access associated with it.
Puts an access in the store.
Callbacks
@callback all_accesses() :: [CsrfPlus.UserAccess.t()]
Returns all the accesses in the store.
@callback delete_access(access_id :: String.t()) :: {:ok, CsrfPlus.UserAccess.t()} | {:error, term()}
Deletes an access from the store by its access_id
.
Returns
{:ok, user_access}
if the access was successfully deleted.user_access
is the access that was deleted.{:error, reason}
if it was not possible for anyreason
.
@callback delete_dead_accesses(max_age :: non_neg_integer()) :: :ok | {:error, term()}
May delete all the tokens in the store that had expired. Other option, is to flag them as expired.
Returns
:ok
in case of success or {:error, reason}
otherwise.
@callback get_access(access_id :: String.t()) :: CsrfPlus.UserAccess.t() | nil
Given an access_id
, returns the access associated with it.
@callback put_access(user_access :: CsrfPlus.UserAccess.t()) :: {:ok, CsrfPlus.UserAccess.t()} | {:error, term()}
Puts an access in the store.
Returns
{:ok, UserAccess.t()}
if the access was successfully store{:error, reason}
if it was not possible for anyreason
.