PtcRunner.Kernel.MCPOAuth.Context (PtcRunner v0.14.0)

Copy Markdown View Source

Principal-scoped host authorization context.

Hosts construct a context from already authenticated tenant/principal identity. No MCP response, manifest, process dictionary, or application environment may supply these values. Construction atomically claims the principal lifecycle epoch from the configured store under the caller's absolute deadline.

Summary

Types

credential_resolver()

@type credential_resolver() :: (binary(), integer() ->
                            {:ok, term()} | {:error, atom()})

interaction()

@type interaction() :: module() | nil

t()

@type t() :: %PtcRunner.Kernel.MCPOAuth.Context{
  credential_resolver: credential_resolver(),
  interaction: interaction(),
  principal_epoch: term(),
  principal_id: binary(),
  store: PtcRunner.Kernel.MCPOAuth.Store.t(),
  tenant_id: binary()
}

Functions

grant_key(context, authority, authority_epoch)

new(opts)

@spec new(keyword()) :: {:ok, t()} | {:error, atom()}