Created
December 24, 2010 15:17
-
-
Save bohde/754329 to your computer and use it in GitHub Desktop.
Django based auth for Tastypie
This file contains 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 tastypie.authentication import Authentication | |
class DjangoAuthentication(Authentication): | |
"""Authenticate based upon Django session""" | |
def is_authenticated(self, request, **kwargs): | |
return request.user.is_authenticated() |
It looks like they've recreated what the auth middleware does. As long as you are using the auth middleware, these should be equivalent.
Awesome. Thank you.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
What's the difference between this and http://www.sysadminpy.com/2011/11/ajax-and-tastypie-check-if-a-user-has-authenticated/?