View Source Guardian.DB.Adapter behaviour (Guardian.DB v3.0.0)

The Guardian DB Adapter.

This behaviour allows to use any storage system for Guardian Tokens.

Summary

Callbacks

Deletes JWT token Used in Guardian.DB.Token.destroy_token/3

Purges all JWT tokens for a given subject.

Purges all expired JWT tokens.

Callbacks

Link to this callback

delete(schema_or_changeset, opts)

View Source
@callback delete(schema_or_changeset(), opts()) :: {:ok, schema()} | {:error, changeset()}

Deletes JWT token Used in Guardian.DB.Token.destroy_token/3

Link to this callback

delete_by_sub(sub, opts)

View Source
@callback delete_by_sub(sub(), opts()) :: {integer(), nil | [term()]}

Purges all JWT tokens for a given subject.

Returns a tuple containing the number of entries and any returned result as second element.

Link to this callback

insert(schema_or_changeset, opts)

View Source
@callback insert(schema_or_changeset(), opts()) :: {:ok, schema()} | {:error, changeset()}

Persists JWT token Used in Guardian.DB.Token.create/2

@callback one(claims(), opts()) :: schema() | nil

Retrieves JWT token Used in Guardian.DB.Token.find_by_claims/1

Link to this callback

purge_expired_tokens(exp, opts)

View Source
@callback purge_expired_tokens(exp(), opts()) :: {integer(), nil | [term()]}

Purges all expired JWT tokens.

Returns a tuple containing the number of entries and any returned result as second element.