Skip to content

Accounts: CyberdyneAuth provisioning adapter - #107

Merged
leonardoaraujosantos merged 4 commits into
mainfrom
feat/cyberdyneauth-provisioner
Sep 27, 2026
Merged

leonardoaraujosantos merged 4 commits into
mainfrom
feat/cyberdyneauth-provisioner

Conversation

@leonardoaraujosantos

Copy link
Copy Markdown
Contributor

Adds the provisioner behind /account create: a client_credentials client (scope users:provision) that fetches and caches a token, retries once on 401, and POSTs {email, name?, locale?} to CyberdyneAuth, reading only the status (202 accepted; 429/422/other = try again later, not counted; 422 logs a name-rule drift warning). Shares OIDC client-auth selection with the console sign-in. Only statuses are logged.

No migration. Wired only when ACCOUNT_PROVISIONING_ISSUER / _CLIENT_ID / _CLIENT_SECRET are set on the bot (a partial set refuses to start); with ACCOUNT_PROVISIONING_ENABLED=true, PROVISIONING_EMAIL_KEY and ADMIN_PUBLIC_URL, /account is then offered.

Tests: unit + integration + e2e green locally; mypy, ruff, openspec strict clean.

AccountProvisioner over the approved contract: a client_credentials token
(scope users:provision) from the token endpoint named in the issuer's
discovery, then POST /api/v1/users/provision with {email, name?, locale?}.
202 is accepted without reading the body, 429 raises ProvisioningRateLimited,
422 the new ProvisioningInvalidName (uncounted like the rest, logged as a
warning since it means our name rule drifted from CyberdyneAuth's), anything
else ProvisioningUnavailable. The token is cached until 30s before expiry and
a 401 gets one fresh token and one retry. Only statuses are logged.

The bot builds it over Edges.http_transport only when
ACCOUNT_PROVISIONING_CLIENT_ID and _SECRET are both set, with
ACCOUNT_PROVISIONING_ISSUER (https); a partial client refuses to start. The
secret is registered as a credential and given to the bot service only.
ACCOUNT_PROVISIONING_ENABLED stays off until CyberdyneAuth deploys the
endpoint and issues the client.
Move client_secret_basic/post selection and the discovery auth-method
parsing into adapters/oidc_client so the console sign-in and the
provisioning adapter cannot drift apart.

Test that assemble builds the CyberdyneAuth adapter over the edges'
transport when only the client is configured, that a 422 warns the
operator without the name or email, and the adapter's guards: non-bearer
tokens, discovery without a token endpoint, refused token status,
percent-encoded Basic credentials, the timeout, discovery caching and the
token's repr. State 422 in the design's contract section.
@leonardoaraujosantos
leonardoaraujosantos merged commit c3a9db5 into main Sep 27, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant