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 <jens@goauthentik.io>
Co-authored-by: Jens L <jens@goauthentik.io>
This commit is contained in:
gcp-cherry-pick-bot[bot]
2024-02-21 19:19:53 +01:00
committed by GitHub
parent 310983a4d0
commit e34d4c0669
2 changed files with 3 additions and 2 deletions

View File

@ -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

View File

@ -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=(