From a8566ba1ec6362807ba57ed7b1ccf345069a7989 Mon Sep 17 00:00:00 2001 From: Jason Mulligan Date: Mon, 5 Jan 2015 13:42:06 -0500 Subject: [PATCH] Passing the `View` to `CSRFCheck().process_view()`. Fixes #2376. --- rest_framework/authentication.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/authentication.py b/rest_framework/authentication.py index 4832ad33b..e419d2cc3 100644 --- a/rest_framework/authentication.py +++ b/rest_framework/authentication.py @@ -126,7 +126,7 @@ class SessionAuthentication(BaseAuthentication): """ Enforce CSRF validation for session based authentication. """ - reason = CSRFCheck().process_view(request, None, (), {}) + reason = CSRFCheck().process_view(request, request.resolver_match[0] if hasattr(request, 'resolver_match') else None, (), {}) if reason: # CSRF failed, bail with explicit error message raise exceptions.PermissionDenied('CSRF Failed: %s' % reason)