+class DjangoAuthentication(object):
+ """
+ Authentication handler that always returns
+ True, so no authentication is needed, nor
+ initiated (`challenge` is missing.)
+ """
+ def is_authenticated(self, request):
+ return request.user.is_authenticated()
+
+ def challenge(self):
+ from django.http import HttpResponse
+ resp = HttpResponse("Authorization Required")
+ resp.status_code = 401
+ return resp
+
+