From 84ac7e90da553730349150627a002cc41e5c7b1e Mon Sep 17 00:00:00 2001 From: Philippe Luickx Date: Sun, 12 Apr 2015 20:21:30 +0300 Subject: [PATCH] dummy auth provider to ensure that not logged in users can have access --- rest_auth/views.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rest_auth/views.py b/rest_auth/views.py index b11f6a4..3b6c7e5 100644 --- a/rest_auth/views.py +++ b/rest_auth/views.py @@ -8,6 +8,7 @@ from rest_framework.generics import GenericAPIView from rest_framework.permissions import IsAuthenticated, AllowAny from rest_framework.authtoken.models import Token from rest_framework.generics import RetrieveUpdateAPIView +from rest_framework.authentication import SessionAuthentication from .app_settings import ( TokenSerializer, @@ -19,6 +20,12 @@ from .app_settings import ( ) +# http://bytefilia.com/titanium-mobile-facebook-application-django-allauth-sign-sign/ +class EverybodyCanAuthentication(SessionAuthentication): + def authenticate(self, request): + return None + + class Login(GenericAPIView): """ @@ -31,6 +38,7 @@ class Login(GenericAPIView): Return the REST Framework Token Object's key. """ permission_classes = (AllowAny,) + authentication_classes = (EverybodyCanAuthentication,) serializer_class = LoginSerializer token_model = Token response_serializer = TokenSerializer