Skip to content

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

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

Bccorb merged 4 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.

  • VerifiedUser.is_client (read-only property): true when sub equals client_id, as Node's isClient.
  • ResourceServer.authenticate(..., allow_clients=True), RequireBearer(server, *guards, allow_clients=True) (FastAPI) and require_bearer(*, server=None, allow_clients=True) (Django). The default keeps today's behavior.
  • With allow_clients=False, a client token that verifies gets 403 {"error": "user_required"} with no WWW-Authenticate, the same shape as insufficient_role. Missing and invalid tokens still get their 401s first, and scope, role and step-up guards run after.
  • tests/data/verify_only_vectors.json is the new shared copy (sha256 3818c68b...f690f): is_client beside user on valid verify entries, and user_required_requests run through FastAPI and Django (sync and async).

a131828 adds the tests and vectors alone and fails there (the option does not exist yet). ruff, ruff format, mypy strict pass; pytest 549 passed.

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

Bccorb and others added 4 commits November 2, 2026 22:25
Update the shared verify-only vectors with is_client on valid verify
entries and the user_required_requests list, and run them through the
FastAPI and Django request harness.

Refs fells-code/seamless-auth-server#260
VerifiedUser gains is_client, true for a client credentials token
(sub equals client_id). ResourceServer.authenticate, RequireBearer and
require_bearer take allow_clients, default True. With it False a
client token that verifies is refused with 403 user_required and no
WWW-Authenticate, before the scope, role and step-up guards run.

Refs fells-code/seamless-auth-server#260
…allow-clients

# Conflicts:
#	src/seamless_auth/fastapi.py
@Bccorb
Bccorb merged commit d095109 into main Nov 5, 2026
7 checks passed
@github-actions github-actions Bot mentioned this pull request Nov 5, 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