Alternera.Plugin.Provisional.Identity (alternera_plugin_sdk v0.9.0)

Copy Markdown View Source

Provisional: added for Assert caller, and a change to it needs a changelog line but no new major (docs/USER_PLUGINS_DESIGN.md).

The exchange's signed-in caller, as the application knows it, through Alternera.Plugin.Host:

  • caller/3 answers the claims of an assertion naming the caller for audience, valid lifetime_seconds (string keys; "sub" is the caller), or :anonymous when no one signed in. The host reads the exchange's sign-in from the context;
  • sign/2 signs those claims with the tenant's key: {:ok, token}, a JWT an upstream checks against the tenant's published key set, or {:error, message}.

A preview signs nothing: the plugin reads context.dry_run? and writes what the header would hold instead.

Summary

Functions

The assertion's claims for the exchange's caller, or :anonymous.

Signs claims with the tenant's key.

Functions

caller(context, audience, lifetime_seconds)

@spec caller(map(), String.t(), pos_integer()) :: {:ok, map()} | :anonymous

The assertion's claims for the exchange's caller, or :anonymous.

sign(context, claims)

@spec sign(map(), map()) :: {:ok, String.t()} | {:error, String.t()}

Signs claims with the tenant's key.