From 4b551add1a0925ba0ed0e18920f53302d4f03585 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Sun, 17 Jan 2021 20:18:45 +0100 Subject: [PATCH] stages/password: catch importerror during authentic() --- authentik/stages/password/stage.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/authentik/stages/password/stage.py b/authentik/stages/password/stage.py index 6af83a16e..ee6d15b52 100644 --- a/authentik/stages/password/stage.py +++ b/authentik/stages/password/stage.py @@ -31,7 +31,11 @@ def authenticate( Customized version of django's authenticate, which accepts a list of backends""" for backend_path in backends: - backend: BaseBackend = path_to_class(backend_path)() + try: + backend: BaseBackend = path_to_class(backend_path)() + except ImportError: + LOGGER.warning("Failed to import backend", path=backend_path) + continue LOGGER.debug("Attempting authentication...", backend=backend) user = backend.authenticate(request, **credentials) if user is None: