stages/authenticator_validate: fix error in passwordless webauthn

closes #3050

Signed-off-by: Jens Langhammer <jens.langhammer@beryju.org>
This commit is contained in:
Jens Langhammer 2022-06-06 13:50:11 +02:00
parent 4c39e08dd4
commit 9add8479ca

View file

@ -374,9 +374,9 @@ class AuthenticatorValidateStageView(ChallengeStageView):
# All validation is done by the serializer
user = self.executor.plan.context.get(PLAN_CONTEXT_PENDING_USER)
if not user:
webauthn_device: WebAuthnDevice = response.data.get("webauthn", None)
if not webauthn_device:
return self.executor.stage_ok()
if not "webauthn" not in response.data:
return self.executor.stage_invalid()
webauthn_device: WebAuthnDevice = response.device
self.logger.debug("Set user from user-less flow", user=webauthn_device.user)
self.executor.plan.context[PLAN_CONTEXT_PENDING_USER] = webauthn_device.user
self.executor.plan.context[PLAN_CONTEXT_METHOD] = "auth_webauthn_pwl"