Pristine.Ports.OAuthBackend behaviour (Pristine v0.3.1)

Copy Markdown View Source

Boundary for OAuth control-plane request shaping and token normalization.

Summary

Types

grant_type()

@type grant_type() ::
  :authorization_code | :refresh_token | :client_credentials | :password

request_kind()

@type request_kind() :: {:token, grant_type()} | :revoke | :introspect

Callbacks

authorization_url(t, keyword)

@callback authorization_url(Pristine.OAuth2.Provider.t(), keyword()) ::
  {:ok, String.t()} | {:error, term()}

available?()

@callback available?() :: boolean()

build_request(t, request_kind, arg3, keyword)

@callback build_request(
  Pristine.OAuth2.Provider.t(),
  request_kind(),
  map() | keyword(),
  keyword()
) ::
  {:ok, Pristine.Ports.OAuthBackend.Request.t()} | {:error, term()}

normalize_token_response(t, arg2)

@callback normalize_token_response(Pristine.OAuth2.Provider.t(), map() | String.t()) ::
  {:ok, Pristine.OAuth2.Token.t()} | {:error, term()}