code: def http_auth(self):
          
          if 'HTTP_AUTHORIZATION' in self.request.META.keys():
              authmeth, auth = self.request.META['HTTP_AUTHORIZATION'].split(
                  ' ', 1)
              if authmeth.lower() == 'basic':
                  auth = auth.strip().decode('base64')
                  identifier, password = auth.split(':', 1)
                  username = get_username(identifier)
                  user = authenticate(username=username, password=password)
                  if user:
                      login(self.request, user)
                      return True
docs: Returns ``True`` if valid http auth credentials are found in the
          request header.