Repository navigation
refactor(api): remove unused authenticate and checkUserAPIKey helpers - #599
Merged
Merged
Conversation
Handler.authenticate, checkUserAPIKey and checkBearerToken had no production callers; requireAuth uses authenticatePrincipal. The tests that exercised them now call authenticatePrincipal, and the user API key validation failure case is covered through requireAuth.
Contributor
|
Warning Review limit reached
This review includes 3 billable files and costs up to $0.75.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 14 minutes for your next included review. View limit detailsLimit details: You’ve used the included review currently available. Your 64 included PR review attempts over the past 7 days set your current allowance at 1 review per hour. Review configuration: ⚙️ Run configuration
📒 Files selected for processing (3)
Comment |
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.
Removes the helpers listed in the last open item of #528.
Handler.authenticate,checkUserAPIKeyandcheckBearerTokenhad no callers outside tests (grepped every package, cmd/, scripts and the integration/e2e build tags).requireAuthresolves credentials throughauthenticatePrincipal.Coverage mapping:
middleware_test.goadmin-key table and the two bearer-token tests now callauthenticatePrincipal(same cases, plus a Principal kind check for sessions); renamed accordingly.TestHandler_checkUserAPIKey_ValidKey->TestRequireAuth_UserAPIKey(router_authuser_test.go:303)._EmptyKeyand_NilAuth->TestRequireAuth_NilAuth_Rejects(router_authuser_test.go:355) and the empty-key branch ofprincipalFromUserAPIKey._InvalidKey-> newTestRequireAuth_UserAPIKey_InvalidKey(validation error gives 401).#528 acceptance on main: spec session and token modes with 401/403/409 for approve, cancel, RI-approve and email revoke (openapi.yaml, merged #563/#584/#589/#594); out-of-scope approve tests (execution_scope_test.go:366, handler_purchases_test.go:2978); stale comment corrected (handler_purchases_test.go:3259); dead helpers removed here. Nothing remains.
Gates: go build, go vet ./..., go vet -tags integration ./internal/..., go vet -tags e2e ./..., go test -race -short ./... all pass; misspell -locale US clean on changed files.
Closes #528