Sake.Auth.Clients (Sake v0.1.0)

Copy Markdown View Source

Clients the host registers itself (for its own CLIs or partners).

{:ok, client, secret} = Sake.Auth.Clients.create(Sake.Auth.config(), %{name: "Ops CLI", redirect_uris: ["http://127.0.0.1:8765/callback"]})

confidential: true returns a secret once; store it where the client can read it. scopes: limits what the client may request.

Summary

Functions

Finds a client by id: a CIMD URL is fetched, anything else is looked up in the store.

Functions

create(config, attrs)

@spec create(Sake.Auth.Config.t(), map()) ::
  {:ok, Sake.Auth.Client.t(), String.t() | nil} | {:error, map()}

delete(config, id)

@spec delete(Sake.Auth.Config.t(), String.t()) :: :ok

get(config, id)

@spec get(Sake.Auth.Config.t(), String.t()) :: {:ok, Sake.Auth.Client.t()} | :error

list(config)

@spec list(Sake.Auth.Config.t()) :: [Sake.Auth.Client.t()]

resolve(config, id)

@spec resolve(Sake.Auth.Config.t(), term()) ::
  {:ok, Sake.Auth.Client.t()}
  | {:error, :invalid_client | :not_allowed | :unreachable | :invalid_document}

Finds a client by id: a CIMD URL is fetched, anything else is looked up in the store.