Repository navigation
feat: let verify-only resource servers require a user - #37
Merged
Merged
Conversation
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
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.
TokenUser::is_client: true whensubequalsclient_id, as Node'sisClient.TokenUseris#[non_exhaustive], so the field is additive.RequireTokenLayer::allow_clients(bool)(default true), following therequire_auth().allow_recovery(true)pattern.allow_clients(false), a client token that verifies gets 403{"error":"user_required"}with noWWW-Authenticate, the same shape as the role refusal, through the newTokenError::UserRequiredvariant. Missing and invalid tokens keep their 401s, and scope, role and step-up guards run after.Verifier::authenticatenever returns it.src/testdata/verify-only-vectors.jsonis the new shared copy (sha2563818c68b...f690f):is_clienton valid verify entries, anduser_required_requeststhrough the request harness.6f6a224adds 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), andcargo docpass.cargo semver-checks --baseline-version 0.5.0: no semver update required.The manifest drift check fails on
main; #36 fixes it.