Skip to content

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

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.IsClient: true when sub equals client_id, as Node's isClient.
  • Verifier.RequireTokenWith(opts ...TokenOption) with AllowClients(bool) (default true). RequireToken keeps its signature and delegates to it, so today's behavior is unchanged. Functional options were chosen because a plain AllowClients bool field would default to false.
  • With AllowClients(false), a client token that verifies gets 403 {"error":"user_required"} with no WWW-Authenticate, the same shape as the role refusal. Missing and invalid tokens keep their 401s, and scope, role and step-up guards run after. Verifier.Authenticate is unchanged; its callers check IsClient themselves.
  • 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.

ddd6578 adds the tests and vectors alone and does not build there (the API does not exist yet). gofmt, go vet, go test -race pass; scripts/api-check.sh reports only compatible changes and suggests v0.6.0.

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

Bccorb and others added 3 commits November 2, 2026 22:25
Copy the shared verify-only vectors, which add is_client to each valid
verify entry and a user_required_requests list run with allow_clients
false. Assert IsClient on the verified user and run those requests
through RequireTokenWith(AllowClients(false)).

Refs fells-code/seamless-auth-server#260
TokenUser gains IsClient, true for a client credentials token (sub equals
client_id). RequireTokenWith(AllowClients(false)) refuses such a token
with 403 user_required, without a WWW-Authenticate challenge, after it
verifies and before any guard inside runs. AllowClients defaults to true,
so RequireToken is unchanged.

Refs fells-code/seamless-auth-server#260
@Bccorb
Bccorb merged commit cee15df into main Nov 3, 2026
5 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