Repository navigation
feat: let verify-only resource servers require a user - #32
Merged
Merged
Conversation
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
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.IsClient: true whensubequalsclient_id, as Node'sisClient.Verifier.RequireTokenWith(opts ...TokenOption)withAllowClients(bool)(default true).RequireTokenkeeps its signature and delegates to it, so today's behavior is unchanged. Functional options were chosen because a plainAllowClients boolfield would default to false.AllowClients(false), a client token that verifies gets 403{"error":"user_required"}with noWWW-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.Authenticateis unchanged; its callers checkIsClientthemselves.testdata/verify_only_vectors.jsonis the new shared copy (sha2563818c68b...f690f):is_clienton valid verify entries, anduser_required_requeststhrough the request harness.ddd6578adds the tests and vectors alone and does not build there (the API does not exist yet). gofmt, go vet,go test -racepass;scripts/api-check.shreports only compatible changes and suggests v0.6.0.The manifest drift check fails on
main; #31 fixes it.