aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/authenticators.py
diff options
context:
space:
mode:
authorTom Christie2011-04-04 09:19:49 +0100
committerTom Christie2011-04-04 09:19:49 +0100
commit5e2e2f14229577b6294bafbd9b420b2a6deeb6f0 (patch)
treefec8cb2f21fd9faa78a9f6bcfcb223f3d54d77e6 /djangorestframework/authenticators.py
parent3cdb4e26486e93a22231a7224a31f1490554a00c (diff)
downloaddjango-rest-framework-5e2e2f14229577b6294bafbd9b420b2a6deeb6f0.tar.bz2
Turn streaming request parsing back on for 1.3. Fix CSRF which was breaking it. It's really not at all obvious if we need to byte limit the stream that we hand over or not.
Diffstat (limited to 'djangorestframework/authenticators.py')
-rw-r--r--djangorestframework/authenticators.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/djangorestframework/authenticators.py b/djangorestframework/authenticators.py
index 29875c64..ce7abd10 100644
--- a/djangorestframework/authenticators.py
+++ b/djangorestframework/authenticators.py
@@ -71,8 +71,11 @@ class BasicAuthenticator(BaseAuthenticator):
class UserLoggedInAuthenticator(BaseAuthenticator):
"""Use Djagno's built-in request session for authentication."""
def authenticate(self, request):
- if getattr(request, 'user', None) and request.user.is_active:
+ if getattr(request, 'user', None) and request.user.is_active:
+ # Temporarily request.POST with .RAW_CONTENT, so that we use our more generic request parsing
+ request._post = self.mixin.RAW_CONTENT
resp = CsrfViewMiddleware().process_view(request, None, (), {})
+ del(request._post)
if resp is None: # csrf passed
return request.user
return None