From b7062c5b01fbcd1fecb9ad2cd9a73eba77bd7632 Mon Sep 17 00:00:00 2001 From: Tom Christie Date: Thu, 6 Sep 2012 14:50:43 +0100 Subject: Add support for request.auth --- djangorestframework/authentication.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'djangorestframework/authentication.py') diff --git a/djangorestframework/authentication.py b/djangorestframework/authentication.py index 4ebe7259..4d5a7e86 100644 --- a/djangorestframework/authentication.py +++ b/djangorestframework/authentication.py @@ -64,7 +64,6 @@ class BasicAuthentication(BaseAuthentication): return None return self.authenticate_credentials(userid, password) - return None def authenticate_credentials(self, userid, password): """ @@ -81,7 +80,7 @@ class UserBasicAuthentication(BasicAuthentication): """ user = authenticate(username=userid, password=password) if user is not None and user.is_active: - return user + return (user, None) class SessionAuthentication(BaseAuthentication): @@ -101,8 +100,7 @@ class SessionAuthentication(BaseAuthentication): resp = CsrfViewMiddleware().process_view(request, None, (), {}) if resp is None: # csrf passed - return user - return None + return (user, None) # TODO: TokenAuthentication, DigestAuthentication, OAuthAuthentication -- cgit v1.2.3