aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/authentication.py
diff options
context:
space:
mode:
authorTom Christie2012-09-06 14:50:43 +0100
committerTom Christie2012-09-06 14:50:43 +0100
commitb7062c5b01fbcd1fecb9ad2cd9a73eba77bd7632 (patch)
tree4ce97e80eb311657ee622a639658ef4b059fcf26 /djangorestframework/authentication.py
parent1c78bf53dbc4f75cfdc240c72f4db9d2376cb9cb (diff)
downloaddjango-rest-framework-b7062c5b01fbcd1fecb9ad2cd9a73eba77bd7632.tar.bz2
Add support for request.auth
Diffstat (limited to 'djangorestframework/authentication.py')
-rw-r--r--djangorestframework/authentication.py6
1 files changed, 2 insertions, 4 deletions
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