Opened 4 years ago

Closed 4 years ago

#31968 closed New feature (wontfix)

Handling of no auth backend failed

Reported by: James Michael (Mike) DuPont Owned by: nobody
Component: contrib.auth Version: 2.2
Severity: Normal Keywords: typecheck
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

The code here checks if the auth backends support the function signature, and fails them if they do not match.
We are upgrading from 1.9 to 2.2 and encountered the issue that all the backends failed the test and no exception was raised.
I would like to propose that we track which backends were tested in an array and if that array size is zero that we raise an exception that no backend could be found for verification, this would have saved us some time.
For extra points, this test of the backend could be done at startup time and the invalid plugins could be marked on starting django instead of waiting for the time of usage. A static type check basically at load time of all plugins for compatibility.

https://github.com/django/django/blob/dc39e62e6b652f006a77b91df02e1dc801597396/django/contrib/auth/__init__.py#L84

Change History (1)

comment:1 by Mariusz Felisiak, 4 years ago

Easy pickings: unset
Resolution: wontfix
Status: newclosed

We are upgrading from 1.9 to 2.2 and encountered the issue that all the backends failed the test and no exception was raised.

You should always upgrade through each feature release incrementally (1.9 to 2.0 to 2.1 to 2.2) in such cases you wouldn't have missed deprecation warning about the authenticate() signature.

I would like to propose that we track which backends were tested in an array and if that array size is zero that we raise an exception that no backend could be found for verification, this would have saved us some time.

I think it's not worth the complexity and a potential performance regression (extra check when authenticating each user). You encountered this issue because you try to bump few version at once, which is not recommended.

For extra points, this test of the backend could be done at startup time and the invalid plugins could be marked on starting django instead of waiting for the time of usage. A static type check basically at load time of all plugins for compatibility.

The Technical Board decided to don't add static typechecking to Django.

Note: See TracTickets for help on using tickets.
Back to Top