title: Django and Middleware which uses request.user is always Anonymous
body: <p>I'm trying to make middleware which alters some fields for the user based on subdomain, etc...</p>
  
  <p>The only problem is the request.user always comes in as AnonymousUser within the middleware, but is then the correct user within the views.  I've left the default authentication and session middleware django uses within the settings.</p>
  
  <p>There is a similar question here: <a href="https://stackoverflow.com/questions/5376985/django-request-user-is-always-anonymous-user">Django, request.user is always Anonymous User</a>
  But doesn't overly answer the total question because I'm not using different authentication methods, and djangos authentication is running before I invoke my own middleware.</p>
  
  <p>Is there a way, while using DRF, to get the request.user within the middleware?  I'll show some sample code here:</p>
  
  <pre><code>class SampleMiddleware(object):
  
    def process_view(self, request, view_func, view_args, view_kwargs):
      #This will be AnonymousUser.  I need it to be the actual user making the request.
      print (request.user)    
  
    def process_response(self, request, response):
      return response
  </code></pre>
  
  <p>with process_request:</p>
  
  <pre><code>class SampleMiddleware(object):
  
    def process_request(self, request):
      #This will be AnonymousUser.  I need it to be the actual user making the request.
      print (request.user)    
  
    def process_response(self, request, response):
      return response
  </code></pre>