From e875db8f6683628ac91787d748ce52b3f32d67d7 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Mon, 7 Feb 2022 20:31:49 +0100 Subject: [PATCH] stages/authenticator_validate: handle non-existent device_challenges Signed-off-by: Jens Langhammer --- authentik/stages/authenticator_validate/stage.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/authentik/stages/authenticator_validate/stage.py b/authentik/stages/authenticator_validate/stage.py index b16b8d340..d30ff1ad2 100644 --- a/authentik/stages/authenticator_validate/stage.py +++ b/authentik/stages/authenticator_validate/stage.py @@ -196,7 +196,10 @@ class AuthenticatorValidateStageView(ChallengeStageView): return super().get(request, *args, **kwargs) def get_challenge(self) -> AuthenticatorValidationChallenge: - challenges = self.request.session["device_challenges"] + challenges = self.request.session.get("device_challenges") + if not challenges: + LOGGER.debug("Authenticator Validation stage ran without challenges") + return self.executor.stage_invalid() return AuthenticatorValidationChallenge( data={ "type": ChallengeTypes.NATIVE.value,