Repository navigation
feat: let verify-only resource servers require a user - #35
Merged
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 whensubequalsclient_id, as Node'sisClient.ResourceServer.authenticate(..., allow_clients=True),RequireBearer(server, *guards, allow_clients=True)(FastAPI) andrequire_bearer(*, server=None, allow_clients=True)(Django). The default keeps today's behavior.allow_clients=False, a client token that verifies gets 403{"error": "user_required"}with noWWW-Authenticate, the same shape asinsufficient_role. Missing and invalid tokens still get their 401s first, and scope, role and step-up guards run after.tests/data/verify_only_vectors.jsonis the new shared copy (sha2563818c68b...f690f):is_clientbesideuseron valid verify entries, anduser_required_requestsrun through FastAPI and Django (sync and async).a131828adds 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.