Backplane.Oauth.AccessTokens behaviour (backplane_oauth v1.10.77)

Copy Markdown View Source

Access token context

Summary

Callbacks

Persists a token with the given params.

Returns a Backplane.Oauth.Token either by value or refresh_token.

Revokes only the given Backplane.Oauth.Token refresh token.

Callbacks

create(params, options)

@callback create(
  params :: %{
    :client => Backplane.Oauth.Client.t(),
    :sub => String.t(),
    optional(:redirect_uri) => String.t(),
    :scope => String.t(),
    optional(:state) => String.t(),
    optional(:previous_token) => String.t(),
    optional(:resource_owner) => Backplane.Oauth.ResourceOwner.t()
  },
  options :: [{:refresh_token, boolean()}]
) :: token :: Backplane.Oauth.Token.t() | {:error, reason :: term()}

Persists a token with the given params.

get_by(arg1)

@callback get_by([{:value, String.t()}] | [{:refresh_token, String.t()}]) ::
  token :: Backplane.Oauth.Token.t() | nil

Returns a Backplane.Oauth.Token either by value or refresh_token.

revoke(token)

@callback revoke(token :: Backplane.Oauth.Token.t()) ::
  {:ok, Backplane.Oauth.Token.t()} | {:error, reason :: term()}

Revokes the given Backplane.Oauth.Token.

revoke_refresh_token(token)

@callback revoke_refresh_token(token :: Backplane.Oauth.Token.t()) ::
  {:ok, Backplane.Oauth.Token.t()} | {:error, reason :: term()}

Revokes only the given Backplane.Oauth.Token refresh token.