#33513: Custom authentication class: raising AuthenticationFailed leads to 403
----------------------------------------+--------------------------------
Reporter: Wissperwind | Owner: nobody
Type: Bug | Status: new
Component: contrib.auth | Version: 3.2
Severity: Normal | Keywords: authentication
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
----------------------------------------+--------------------------------
Hi,
I am writing a custom authentication class. I overwrite:
**def authenticate(self, request):**
If a user is not authenticated I do:
**raise exceptions.AuthenticationFailed(_('Invalid token.'))**
I expect that djano returns a 401. But django returns 403 like i were in
has_permission(). But I am in authenticate() for sure and if there this
exception is raised Django shaluld return a 401!
My custom auth class inherits from BaseAuthentication:
from rest_framework.authentication import BaseAuthentication
--
Ticket URL: <https://code.djangoproject.com/ticket/33513>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/054.da5a6092069b174f57c3ddc18619ea97%40djangoproject.com.