Auctoritas v0.2.1 Auctoritas.AuthenticationManager.DataStorage View Source

Default DataStorage implementation (based on Cachex)

Link to this section Summary

Functions

Check for collisions

Delete token and its data

Get tokens data

Get a list of tokens

Get tokens with associated data (value and expiration)

Check if token exists

Get token expiration (countdown)

Start cachex with custom name

Link to this section Types

Link to this section Functions

Link to this function

check_collision(name, token) View Source
check_collision(name(), token()) :: boolean()

Check for collisions

Arguments:

  • Name: Name from config
  • Token: Generated token
Link to this function

delete_token(name, token) View Source
delete_token(name(), token()) :: {atom(), any()}

Delete token and its data

Arguments:

  • Name: Name from config
  • Token: Token to delete
Link to this function

get_token_data(name, token) View Source
get_token_data(name(), token()) :: {atom(), any()}

Get tokens data

Arguments:

  • Name: Name from config
  • Token: Generated token
Link to this function

get_tokens(name, start, amount) View Source
get_tokens(name(), non_neg_integer(), non_neg_integer()) :: {atom(), any()}

Get a list of tokens

Arguments:

  • Name: Name from config
  • Start: Starting point in the list
  • Amount: Amount of tokens to take from list
Link to this function

get_tokens_with_data(name, start, amount) View Source
get_tokens_with_data(name(), non_neg_integer(), non_neg_integer()) ::
  {atom(), any()}

Get tokens with associated data (value and expiration)

Arguments:

  • Name: Name from config
  • Start: Starting point in the list
  • Amount: Amount of tokens to take from list
Link to this function

insert_token(name, expiration, token, data, metadata) View Source
insert_token(name(), number(), token(), map(), map()) :: {atom(), any()}

Insert data into storage

Arguments:

  • Name: Name from config
  • Token: Generated token
  • Data: Any kind of data you would like to associate with token
Link to this function

token_exists?(name, token) View Source
token_exists?(name(), token()) :: boolean()

Check if token exists

Arguments:

  • Name: Name from config
  • Token: Generated token
Link to this function

token_expires?(name, token) View Source
token_expires?(name(), token()) :: {atom(), any()}

Get token expiration (countdown)

Arguments:

  • Name: Name from config
  • Token: Generated token
Link to this function

update_metadata(name, token, new_metadata) View Source
update_metadata(name(), token(), map()) :: {atom(), any()}

Callback implementation for Auctoritas.DataStorage.update_metadata/3.

Link to this function

update_token(name, token, new_data) View Source
update_token(name(), token(), map()) :: {atom(), any()}

Update token data

Arguments:

  • Name: Name from config
  • Token: Generated token
  • Data: Data to update (Map.Merge)

Start cachex with custom name