← All Modules

assay.rauthy

Rauthy IdP admin API client. OAuth2 client reconciliation, secret rotation, discovery, and health. Client: rauthy.client(url, api_key).

The api_key argument is the <name>$<secret> form Rauthy expects in the Authorization: API-Key … header (see Rauthy bootstrap docs for how that key is minted).

System / Health (c.sys)

Discovery (c.discovery)

Clients (c.clients)

Reconcile (c.clients:reconcile(payload))

Idempotent reconcile. Decision tree:

Current stateActionReturns
404create + rotate{action="create", secret=string?}
Exists, challenges declared in payload but missing in liverebuild + rotate{action="rebuild", reason="challenges-drift", secret=string?}
Exists, any other field driftsput-only{action="put", drift_on=string}
Exists, no driftnoop{action="noop"}

secret is present iff a rotation happened (only on create / rebuild, only for confidential = true clients). Callers should write it to a Kubernetes Secret (or wherever consumers read it from) the same run. On put and noop, the existing managed secret stays valid — do not overwrite it.

The challenges-drift rebuild path exists because of an upstream Rauthy quirk; reconcile collapses to plain put / noop for all other drift, preserving secrets across reconciles.

Client presets (rauthy.client_presets)

Ready-to-use payloads for common consumers. Each preset bakes in the OIDC verifier quirks of its consumer so a Rauthy-fronted deployment doesn't have to rediscover them via failure logs.

Example

local rauthy = require("assay.rauthy")

local c = rauthy.client("http://rauthy:8080/auth/v1", "ansible$" .. os.getenv("BOOTSTRAP_API_KEY"))
c.sys:wait_healthy()

-- Use a preset; override id/name if you ship multiple OpenBao instances.
local payload = rauthy.client_presets.openbao({ host = "openbao.fcar.ai" })
local r = c.clients:reconcile(payload)

if r.action == "create" or r.action == "rebuild" then
  -- Rotated; write r.secret into a k8s Secret consumer apps mount.
  print("rotated", payload.id, "→ secret needs publishing")
else
  print(payload.id, r.action, r.drift_on or "")
end