From e34d4c06697ab5232097c61999f9057bb1a03c8c Mon Sep 17 00:00:00 2001 From: "gcp-cherry-pick-bot[bot]" <98988430+gcp-cherry-pick-bot[bot]@users.noreply.github.com> Date: Wed, 21 Feb 2024 19:19:53 +0100 Subject: [PATCH] stages/authenticator_validate: fix error with get_webauthn_challenge_without_user (cherry-pick #8625) (#8626) stages/authenticator_validate: fix error with get_webauthn_challenge_without_user (#8625) * stages/authenticator_validate: fix error with get_webauthn_challenge_without_user * fix tests --------- Signed-off-by: Jens Langhammer Co-authored-by: Jens L --- authentik/stages/authenticator_validate/challenge.py | 2 +- authentik/stages/authenticator_validate/tests/test_webauthn.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/authentik/stages/authenticator_validate/challenge.py b/authentik/stages/authenticator_validate/challenge.py index 1a78292495..85f57d1925 100644 --- a/authentik/stages/authenticator_validate/challenge.py +++ b/authentik/stages/authenticator_validate/challenge.py @@ -65,7 +65,7 @@ def get_webauthn_challenge_without_user( authentication_options = generate_authentication_options( rp_id=get_rp_id(request), allow_credentials=[], - user_verification=stage.webauthn_user_verification, + user_verification=UserVerificationRequirement(stage.webauthn_user_verification), ) request.session[SESSION_KEY_WEBAUTHN_CHALLENGE] = authentication_options.challenge diff --git a/authentik/stages/authenticator_validate/tests/test_webauthn.py b/authentik/stages/authenticator_validate/tests/test_webauthn.py index 9d64bff9dc..86b1242f05 100644 --- a/authentik/stages/authenticator_validate/tests/test_webauthn.py +++ b/authentik/stages/authenticator_validate/tests/test_webauthn.py @@ -164,8 +164,9 @@ class AuthenticatorValidateStageWebAuthnTests(FlowTestCase): """Test webauthn (userless)""" request = get_request("/") stage = AuthenticatorValidateStage.objects.create( - name=generate_id(), + name=generate_id(), webauthn_user_verification=UserVerification.PREFERRED ) + stage.refresh_from_db() WebAuthnDevice.objects.create( user=self.user, public_key=(