          """
          user = authenticate(username=userid, password=password)
          if user is not None and user.is_active:
              return (user, None)
  
  
  class SessionAuthentication(BaseAuthentication):
      """
      Use Django's session framework for authentication.
 
</s> remove             return
 </s> add             return None </s> remove                 return user_auth_tuple
 </s> add                 user, auth = user_auth_tuple
                return (authenticator, user, auth) </s> remove         Attempt to authenticate the request using each authentication instance in turn.
        Returns a two-tuple of (user, authtoken).
 </s> add         Attempt to authenticate the request using each authentication instance
        in turn.
        Returns a three-tuple of (authenticator, user, authtoken). </s> remove         if 'HTTP_AUTHORIZATION' in request.META:
            auth = request.META['HTTP_AUTHORIZATION'].split()
            if len(auth) == 2 and auth[0].lower() == "basic":
                try:
                    auth_parts = base64.b64decode(auth[1]).partition(':')
                except TypeError:
                    return None

                try:
                    userid = smart_unicode(auth_parts[0])
                    password = smart_unicode(auth_parts[2])
                except DjangoUnicodeDecodeError:
                    return None

                return self.authenticate_credentials(userid, password)
 </s> add         auth = request.META.get('HTTP_AUTHORIZATION', '').split()

        if not auth or auth[0].lower() != "basic":
            return None

        if len(auth) != 2:
            raise exceptions.AuthenticationFailed('Invalid basic header')

        try:
            auth_parts = base64.b64decode(auth[1]).partition(':')
        except TypeError:
            raise exceptions.AuthenticationFailed('Invalid basic header')

        try:
            userid = smart_unicode(auth_parts[0])
            password = smart_unicode(auth_parts[2])
        except DjangoUnicodeDecodeError:
            raise exceptions.AuthenticationFailed('Invalid basic header')

        return self.authenticate_credentials(userid, password)
        raise exceptions.AuthenticationFailed('Invalid username/password')

    def authenticate_header(self):
        return 'Basic realm="%s"' % self.www_authenticate_realm
          """
          user = authenticate(username=userid, password=password)
          if user is not None and user.is_active:
              return (user, None)
        raise exceptions.AuthenticationFailed('Invalid username/password')

    def authenticate_header(self):
        return 'Basic realm="%s"' % self.www_authenticate_realm
  
  
  class SessionAuthentication(BaseAuthentication):
      """
      Use Django's session framework for authentication.
keep keep keep add keep keep keep keep keep
 Implementing 401 vs 403 responses 
rest_framework/authentication.py