Sake.Auth (Sake v0.1.0)

Copy Markdown View Source

Authorization for a Sake endpoint: the host app is the OAuth 2.1 authorization server, and the endpoint is the resource server.

Configure it on the Sake child (see Sake.child_spec/1) and mount the routes with Sake.Router (Phoenix) or Sake.Auth.RouterPlug (Plug).

Summary

Functions

The active grants of a person: one entry per client, for a settings page.

Deletes expired codes and tokens, and the remembered consents older than the refresh token lifetime that no live token family still uses. Schedule it (a cron job, Oban, or a periodic task).

Revokes every token of a client for a person, and forgets every consent of that client for the person.

Functions

config()

@spec config() :: Sake.Auth.Config.t()

list_grants(config, subject_id)

@spec list_grants(Sake.Auth.Config.t(), String.t()) :: [map()]

The active grants of a person: one entry per client, for a settings page.

prune(config)

@spec prune(Sake.Auth.Config.t()) :: :ok

Deletes expired codes and tokens, and the remembered consents older than the refresh token lifetime that no live token family still uses. Schedule it (a cron job, Oban, or a periodic task).

revoke_grant(config, subject_id, client_id)

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

Revokes every token of a client for a person, and forgets every consent of that client for the person.