Skip to content

feat(auth): add client-key-issuance Okta scope#642

Closed
sophia-chen-ttd wants to merge 4 commits into
mainfrom
sc-UID2-6903-client-key-issuance-scope
Closed

feat(auth): add client-key-issuance Okta scope#642
sophia-chen-ttd wants to merge 4 commits into
mainfrom
sc-UID2-6903-client-key-issuance-scope

Conversation

@sophia-chen-ttd
Copy link
Copy Markdown
Contributor

Summary

  • Add uid2.admin.client-key-issuance Okta custom scope mapped to Role.MAINTAINER
  • Extend OktaCustomScopeTest and AdminAuthMiddlewareTest parameterised cases (authorised + unauthorised)
  • Unblocks the /uid2-client-key Claude skill (UID2-6903)

The new scope grants only MAINTAINER-protected operations (POST /api/client/add, POST /api/site/add, GET /api/site/list, GET /api/client/list/:siteId). It deliberately does not map to SUPER_USER or PRIVILEGED, so client deletion (/api/client/del) and reveal-by-contact (/api/client/reveal) remain unreachable by tokens carrying this scope. Two new unauthorised-case test rows assert this boundary.

Test plan

  • mvn -pl . -am test -Dtest='com.uid2.admin.auth.*' — 48/48 pass locally
  • mvn clean verify — BUILD SUCCESS locally
  • Reviewer confirms the scope→role mapping is appropriate (MAINTAINER only — no SUPER_USER / PRIVILEGED leakage)

Refs: UID2-6903

🤖 Generated with Claude Code

sophia-chen-ttd and others added 4 commits May 21, 2026 10:27
Captures the minimum backend change (one new Okta machine-auth scope
mapped to Role.MAINTAINER) and the workflow for a /uid2-client-key
skill that drives the runbook end-to-end. Scopes the work to UID2
client keys only; operator keys, CSTG, Databricks, and EUID are
explicit follow-ups under the broader UID2-6903 epic.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Task-by-task plan spanning two repos:
  Phase 1 (this repo, uid2-admin): add CLIENT_KEY_ISSUANCE Okta scope
    mapped to Role.MAINTAINER, with parameterised tests mirroring the
    existing SS_PORTAL/SECRET_ROTATION patterns.
  Phase 2 (uid2-claude-skills): new /uid2-client-key skill driving the
    full runbook end-to-end.
  Phase 3 (operational): Okta service account provisioning + 1Password
    credential storage.

Refs: UID2-6903
Spec: docs/superpowers/specs/2026-05-21-claude-client-key-issuance-design.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Three changes from the user:
- Drop the 1Password CLI dependency. Credentials live in shell env vars
  (UID2_ADMIN_CLAUDE_<ENV>_OKTA_CLIENT_ID/_SECRET, shared _AUTH_SERVER).
  Secret distribution becomes a print-to-terminal + engineer-driven
  out-of-band share via the existing Confluence-documented flow.
- Site-not-found halts with a two-option prompt: re-check with a
  corrected name (loop), or authorise creating a new site. No more
  auto-create on a no-match miss.
- Add 'test' env (https://admin.test.uidapi.com). Skill ships with
  three envs (test/integ/prod), and the integration test in Task 19
  now runs against the test deployment, not integ. Same Okta tenant,
  one service account per env (per AdminAuthMiddleware:148 the JWT's
  environment claim must match the admin's configured environment).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds a new OktaCustomScope mapped to Role.MAINTAINER so service-account
access tokens can call MAINTAINER-protected endpoints (POST /api/client/add,
POST /api/site/add, GET /api/site/list, GET /api/client/list/:siteId).

This unblocks the /uid2-client-key Claude skill (see UID2-6903) without
exposing SUPER_USER or PRIVILEGED operations to the same scope.

Tests mirror the existing parameterised SS_PORTAL/SECRET_ROTATION patterns
in OktaCustomScopeTest and AdminAuthMiddlewareTest.

Refs: UID2-6903
Design: docs/superpowers/specs/2026-05-21-claude-client-key-issuance-design.md

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@sophia-chen-ttd
Copy link
Copy Markdown
Contributor Author

Superseded by #643 — same code, just dropped the accidentally-committed planning docs from this branch's history.

@sophia-chen-ttd sophia-chen-ttd deleted the sc-UID2-6903-client-key-issuance-scope branch May 21, 2026 04:00
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