Created
February 11, 2018 17:15
-
-
Save maxpoletaev/404b2076920697451fe7db5d459c1f22 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from rest_framework.authentication import BaseAuthentication | |
class SessionAuthenticationWithoutCsrf(BaseAuthentication): | |
def authenticate(self, request): | |
request = request._request | |
user = getattr(request, 'user', None) | |
if not user or not user.is_active: | |
return None | |
return (user, None) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment