Skip to content

feat: let verify-only resource servers require a user - #37

Merged
Bccorb merged 3 commits into
mainfrom
feat/resource-server-allow-clients
Nov 3, 2026
Merged

Bccorb merged 3 commits into
mainfrom
feat/resource-server-allow-clients

Conversation

@Bccorb

@Bccorb Bccorb commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Parity with the Node adapter for fells-code/seamless-auth-server#260 (shipped in fells-code/seamless-auth-server#270), so a verify-only API can refuse client credentials tokens on routes meant for people.

  • TokenUser::is_client: true when sub equals client_id, as Node's isClient. TokenUser is #[non_exhaustive], so the field is additive.
  • RequireTokenLayer::allow_clients(bool) (default true), following the require_auth().allow_recovery(true) pattern.
  • With allow_clients(false), a client token that verifies gets 403 {"error":"user_required"} with no WWW-Authenticate, the same shape as the role refusal, through the new TokenError::UserRequired variant. Missing and invalid tokens keep their 401s, and scope, role and step-up guards run after. Verifier::authenticate never returns it.
  • src/testdata/verify-only-vectors.json is the new shared copy (sha256 3818c68b...f690f): is_client on valid verify entries, and user_required_requests through the request harness.

6f6a224 adds the tests and vectors alone and does not compile there (the API does not exist yet). fmt, clippy -D warnings (all three feature sets), cargo test (106 + 1 doctest, also on 1.88), and cargo doc pass. cargo semver-checks --baseline-version 0.5.0: no semver update required.

The manifest drift check fails on main; #36 fixes it.

Bccorb and others added 3 commits November 2, 2026 22:25
Replace the shared verify-only vectors with the version that records
is_client beside each valid user and adds user_required_requests, run
through the request harness with require_auth built from
auth.allow_clients.

Refs fells-code/seamless-auth-server#260
TokenUser gains is_client, true for a client-credentials token (sub
equal to client_id). require_auth() gains allow_clients(bool), default
true. With false, a verified client-credentials token is refused with
403 user_required and no WWW-Authenticate header, before any scope,
role or step-up guard runs. TokenError gains UserRequired for that
answer.

Refs fells-code/seamless-auth-server#260
@Bccorb
Bccorb merged commit c096a97 into main Nov 3, 2026
4 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 3, 2026
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