dummy auth provider to ensure that not logged in users can have access

This commit is contained in:
Philippe Luickx 2015-04-12 20:21:30 +03:00
parent c7ef9eb775
commit 84ac7e90da

View File

@ -8,6 +8,7 @@ from rest_framework.generics import GenericAPIView
from rest_framework.permissions import IsAuthenticated, AllowAny from rest_framework.permissions import IsAuthenticated, AllowAny
from rest_framework.authtoken.models import Token from rest_framework.authtoken.models import Token
from rest_framework.generics import RetrieveUpdateAPIView from rest_framework.generics import RetrieveUpdateAPIView
from rest_framework.authentication import SessionAuthentication
from .app_settings import ( from .app_settings import (
TokenSerializer, 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): class Login(GenericAPIView):
""" """
@ -31,6 +38,7 @@ class Login(GenericAPIView):
Return the REST Framework Token Object's key. Return the REST Framework Token Object's key.
""" """
permission_classes = (AllowAny,) permission_classes = (AllowAny,)
authentication_classes = (EverybodyCanAuthentication,)
serializer_class = LoginSerializer serializer_class = LoginSerializer
token_model = Token token_model = Token
response_serializer = TokenSerializer response_serializer = TokenSerializer