mirror of
https://github.com/Tivix/django-rest-auth.git
synced 2025-07-23 14:09:46 +03:00
dummy auth provider to ensure that not logged in users can have access
This commit is contained in:
parent
c7ef9eb775
commit
84ac7e90da
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user