Skip to content

rpuser: audited claims -> local-user provisioning path - #25

Merged
matthewjhunter merged 2 commits into
masterfrom
issue-10-rpuser
Jul 18, 2026
Merged

matthewjhunter merged 2 commits into
masterfrom
issue-10-rpuser

Conversation

@matthewjhunter

Copy link
Copy Markdown
Contributor

Summary

Implements the extraction agreed on #10 (see the revised spec and decision comments there): a new rpuser subpackage owning the post-login user-sync policy that OSG and SF currently carry as near-identical copies.

  • Identity mirrors authz.Identity field-for-field -- no Roles; authorization stays claim-free per the authz trust model.
  • UserStore is the host-implemented boundary (lookup / sync / create); hosts keep their schema and sqlc. The interface docs require (issuer, subject) keying and forbid email matching.
  • Provisioner.Provision is the login-time flow: lookup -> best-effort sync of email/email_verified on a hit -> PreCreate hook (osg's seed-account adoption) -> create on a miss, with created reported for onboarding routing.
  • Middleware.Optional is the per-request flow over session.Manager.Authenticate: strictly read-only (pinned by test), stashes identity/user/claims in context, fail-open anonymous by design with faults logged. Replaces each site's hand-rolled optionalAuth + feeds each site's authz IdentitySource from IdentityFromContext.
  • Identity.Issuer is filled from the client's configured issuer URL, which oidclient already validates the token's iss against -- the same string authz grants key on.
  • User.Host carries the host's own row through the middleware so per-request resolution stays a single DB query.

Testing

TDD: both test files written first and confirmed failing, then the implementation. 18 new tests cover normalization (display-name fallback, issuer injection), the provision flow (create/sync/no-write/adopt/decline/error paths, empty-email non-clobber, best-effort sync), and the middleware (anonymous cases, context population, host-row passthrough, fault logging, and the read-only guarantee). go test ./... green across all three packages; go vet and gofmt clean.

Consumer adoption (OSG, SF -- including the (issuer, subject) schema migrations) follows in separate PRs against those repos once this merges and tags.

Fixes #10

🤖 Generated with Claude Code

matthewjhunter and others added 2 commits July 18, 2026 01:26
Extract the post-login user-sync policy every RP site re-implements into
an oidclient subpackage, per the revised spec on issue #10: Identity
mirrors authz.Identity (no roles -- authorization is never claim-driven),
users key strictly on (issuer, subject) and are never matched by email,
mutable claims sync at login only, and the per-request middleware is
strictly read-only. Hosts keep their schema and SQL behind the
three-method UserStore; a PreCreate hook carries host adoption policies
(osg's seed accounts) without forking the flow.

Issuer comes from the client's configured issuer URL, which oidclient
already validates the token's iss against -- the same string authz
grants are keyed on.

Refs #10

Co-Authored-By: Claude Fable 5 <[email protected]>
govulncheck fails the branch on the ECH privacy leak (GO-2026-5856),
reachable from this module's TLS use and fixed in 1.25.12.

Co-Authored-By: Claude Fable 5 <[email protected]>
@matthewjhunter
matthewjhunter merged commit 8664298 into master Jul 18, 2026
5 checks passed
@matthewjhunter
matthewjhunter deleted the issue-10-rpuser branch July 18, 2026 07:07
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.

rpuser: extract the duplicated claims -> local-user sync into an audited helper

1 participant