Repository navigation
Document that authentication should not depend on the HTTP method - #10105
Merged
browniebroke merged 1 commit intoNov 12, 2026
Merged
Conversation
Add a warning to the "Custom authentication" section of the authentication guide, and a short note under AdminRenderer in the renderers guide. REST framework sometimes clones the current request with a different method, for example in the browsable API, AdminRenderer and OPTIONS metadata. Permissions are checked again for the clone, but authentication is not, so the clone keeps the user and credentials of the original request. An authenticator whose result depends on the HTTP method is therefore not supported, and rules like that belong in permission classes. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
browniebroke
approved these changes
Nov 12, 2026
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.
Adds two short warnings to the docs.
In the "Custom authentication" section of the authentication guide: don't make the result of
.authenticate()depend on the HTTP method, and put rules like that in a permission class. REST framework sometimes makes a copy of the request with a different method (browsable API,AdminRenderer,OPTIONSmetadata). Permissions are checked again for the copy, but authentication is not, so the copy keeps therequest.userandrequest.authof the original request.Under
AdminRendererin the renderers guide: the simulatedGETit makes for a400 Bad Requestresponse keeps therequest.userandrequest.authof the original request, so method-dependent rules belong in permission classes.Docs only, no code changes.
🤖 Generated with Claude Code