diff options
| author | Tom Christie | 2011-04-25 01:03:23 +0100 |
|---|---|---|
| committer | Tom Christie | 2011-04-25 01:03:23 +0100 |
| commit | 4692374e0d6f020f8a7a95f3a60094d525c59341 (patch) | |
| tree | 016dec93ce950027e2ee6f4a6b8c0e1d5ecf2037 /djangorestframework/authenticators.py | |
| parent | cb4b4f6be6eeac3d2383614998a5e1436cb4226e (diff) | |
| download | django-rest-framework-4692374e0d6f020f8a7a95f3a60094d525c59341.tar.bz2 | |
Generic permissions added, allowed_methods and anon_allowed_methods now defunct, dispatch now mirrors View.dispatch more nicely
Diffstat (limited to 'djangorestframework/authenticators.py')
| -rw-r--r-- | djangorestframework/authenticators.py | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/djangorestframework/authenticators.py b/djangorestframework/authenticators.py index e8331cc7..e6f51dd5 100644 --- a/djangorestframework/authenticators.py +++ b/djangorestframework/authenticators.py @@ -13,10 +13,10 @@ import base64 class BaseAuthenticator(object): """All authenticators should extend BaseAuthenticator.""" - def __init__(self, mixin): + def __init__(self, view): """Initialise the authenticator with the mixin instance as state, in case the authenticator needs to access any metadata on the mixin object.""" - self.mixin = mixin + self.view = view def authenticate(self, request): """Authenticate the request and return the authentication context or None. @@ -61,11 +61,13 @@ class BasicAuthenticator(BaseAuthenticator): class UserLoggedInAuthenticator(BaseAuthenticator): - """Use Djagno's built-in request session for authentication.""" + """Use Django's built-in request session for authentication.""" def authenticate(self, request): if getattr(request, 'user', None) and request.user.is_active: - # Temporarily request.POST with .RAW_CONTENT, so that we use our more generic request parsing - request._post = self.mixin.RAW_CONTENT + # Temporarily set request.POST to view.RAW_CONTENT, + # so that we use our more generic request parsing, + # in preference to Django's form-only request parsing. + request._post = self.view.RAW_CONTENT resp = CsrfViewMiddleware().process_view(request, None, (), {}) del(request._post) if resp is None: # csrf passed |
