title: Why my class based view is not authenticating my user?
body: <p>I am using rest_framework_simplejwt for authentication. My user/urls.py looks like this:</p>
  
  <pre><code>from django.contrib import admin
  from . import views as user_views
  from user.security.jwt_auth import GetToken
  admin.autodiscover()
  
  
  # Setup the URLs and include login URLs for the browsable API.
  urlpatterns = [
      path('login', GetToken.as_view(), name='login'),
  ]
  </code></pre>
  
  <p>This route works well and it returns the access_token and the refresh_token.
  Now this is my client/urls.py</p>
  
  <pre><code>from django.urls import path, include
  from django.contrib import admin
  from client import views as client_views
  admin.autodiscover()
  
  
  urlpatterns = [
      path('client', client_views.ClientList.as_view()),
      path('client/&lt;int:pk&gt;', client_views.ClientDetail.as_view()),
      path('create_client', client_views.create_client)
  ]
  
  </code></pre>
  
  <p>Here I am trying to use a decorator for the class. The decorator works well, the problem is that inside the decorator function the request.user does not exist, instead I have to do request.request.user. And when I do that the user is AnonymousUser. I already tried this decorator on the function based view by sending the access_token in the Authorization header and I am able to get the correct user, in other words the JWT Auth works automatically. Then Why it is not working in this scenario?</p>
  
  <p>user/security/decorators.py</p>
  
  <pre><code>def authentication_for_class(function):
      def wrap(request, *args, **kwargs):
          # todo: Finish permissions
          print(request.request.user)
          if request.request.user.is_anonymous:
              return JsonResponse({"detail": "You do not have permission to perform this action."}, status=403)
          return function(request, *args, **kwargs)
  
      wrap.__doc__ = function.__doc__
      wrap.__name__ = function.__name__
      return wrap
  </code></pre>
  
  <p>And this is my client/view.py</p>
  
  <pre><code>from user.security.decorators import authentication_for_class
  
  
  class ClientList(APIView):
  
      @authentication_for_class
      def dispatch(self, request, *args, **kwargs):
          return super(ClientList, self).dispatch(request, *args, **kwargs)
  </code></pre>