From a4de2d6570d6d18a9859abb6f286d6bceeea9ffc Mon Sep 17 00:00:00 2001 From: Noam Cohen Date: Tue, 27 Sep 2022 13:59:51 +0300 Subject: [PATCH] make `enforce_csrf` a class method --- rest_framework/authentication.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/rest_framework/authentication.py b/rest_framework/authentication.py index 382abf158..d8a687dbd 100644 --- a/rest_framework/authentication.py +++ b/rest_framework/authentication.py @@ -132,7 +132,8 @@ class SessionAuthentication(BaseAuthentication): # CSRF passed with authenticated user return (user, None) - def enforce_csrf(self, request): + @classmethod + def enforce_csrf(cls, request): """ Enforce CSRF validation for session based authentication. """