From cae122759be28047727787e1eb4955c56553ede1 Mon Sep 17 00:00:00 2001 From: Raymond Penners Date: Tue, 20 May 2025 18:41:14 +0200 Subject: [PATCH] fix(webauthn): fido2 v2 compatibility --- allauth/mfa/webauthn/internal/auth.py | 7 +++++-- setup.cfg | 10 +++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/allauth/mfa/webauthn/internal/auth.py b/allauth/mfa/webauthn/internal/auth.py index d0751d7aa4..22bae81223 100644 --- a/allauth/mfa/webauthn/internal/auth.py +++ b/allauth/mfa/webauthn/internal/auth.py @@ -23,8 +23,11 @@ from allauth.mfa.models import Authenticator -fido2.features.webauthn_json_mapping.enabled = True - +try: + fido2.features.webauthn_json_mapping.enabled = True # type:ignore[attr-defined] +except AttributeError: + # https://github.com/Yubico/python-fido2/blob/main/doc/Migration_1-2.adoc + pass STATE_SESSION_KEY = "mfa.webauthn.state" EXTENSIONS = {"credProps": True} --- a/setup.cfg 2025-04-03 07:48:54.000000000 -0000 +++ b/setup.cfg 2025-06-16 17:24:37.557366540 -0000 @@ -52,17 +52,17 @@ [options.extras_require] mfa = - qrcode >= 7.0.0 - fido2 >= 1.1.2 + qrcode >= 7.0.0,<9 + fido2 >= 1.1.2,<3 openid = - python3-openid >= 3.0.8 + python3-openid >= 3.0.8,<4 saml = python3-saml>=1.15.0,<2.0.0 steam = - python3-openid >= 3.0.8 + python3-openid >= 3.0.8,<4 socialaccount = requests-oauthlib >= 0.3.0 - requests >= 2.0.0 + requests >= 2.0.0,<3 pyjwt[crypto] >= 1.7 [options.packages.find]