SaltDns.Registrar.Openprovider.Tokens (Salt v1.0.0)

The in-memory cache of Openprovider bearer tokens. A token lives 48 hours at the registrar; Salt uses it for 40 (:refresh_after) and logs in again after that, or once when the registrar answers 401.

A token is kept in memory only, in an ETS table this process owns: never in the database, never in a log. The key is the mode, the user name and a digest of the password, so a changed password does not find the old token. The process is started by the application only when the registrar module is switched on; without it get/2 finds nothing and put/3 does nothing, so every call logs in.

Summary

Functions

Returns a specification to start this module under a supervisor.

Forgets a token.

A cached token younger than refresh_after seconds, or :none.

The cache key for a provider.

Remembers a token.

Functions

child_spec(init_arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

drop(key)

@spec drop(term()) :: :ok

Forgets a token.

get(key, refresh_after)

@spec get(term(), non_neg_integer()) :: {:ok, String.t()} | :none

A cached token younger than refresh_after seconds, or :none.

key(provider)

The cache key for a provider.

put(key, token)

@spec put(term(), String.t()) :: :ok

Remembers a token.