oauth2_token_manager v0.1.0 OAuth2TokenManager.Store.Local View Source

Simple token store using ETS and DETS

Access tokens are stored in an ETS, since they can easily be renewed with an access token. Refresh tokens and claims are stored in DETS.

This implementation is probably not suited for production, firstly because it's not distributed.

Since the ETS table must be owned by a process and a cleanup process must be implemented to delete expired tokens, this implementation must be started under a supervision tree. It implements the child_spec/1 and start_link/1 functions (from GenServer).

The DETS read and write in the following tables:

  • "Elixir.OAuth2TokenManager.Store.Local.RefreshToken" for refresh tokens
  • "Elixir.OAuth2TokenManager.Store.Local.Claims" for claims and ID tokens

Options

  • :cleanup_interval: the interval between cleanups of the underlying ETS and DETS table in seconds. Defaults to 15

Starting this implementation

In your MyApp.Application module, add:

children = [
  OAuth2TokenManager.Store.Local
]

or

children = [
  {OAuth2TokenManager.Store.Local, cleanup_interval: 30}
]

Link to this section Summary

Functions

Returns a specification to start this module under a supervisor.

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.