From 3ab3f819b772f069b6c4e96964b7e41e8421ba38 Mon Sep 17 00:00:00 2001 From: devStorm <59678453+developStorm@users.noreply.github.com> Date: Thu, 7 May 2020 02:33:24 -0700 Subject: [PATCH] Make RP_ID a constant --- app/auth/views/fido.py | 4 ++-- app/dashboard/views/fido_setup.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/auth/views/fido.py b/app/auth/views/fido.py index 5ccfe647..b2387a59 100644 --- a/app/auth/views/fido.py +++ b/app/auth/views/fido.py @@ -40,11 +40,11 @@ def fido(): next_url = request.args.get("next") - rp_id = urlparse(SITE_URL).hostname + RP_ID = urlparse(SITE_URL).hostname webauthn_user = webauthn.WebAuthnUser( user.fido_uuid, user.email, user.name, False, - user.fido_credential_id, user.fido_pk, user.fido_sign_count, rp_id) + user.fido_credential_id, user.fido_pk, user.fido_sign_count, RP_ID) # Handling POST requests if fido_token_form.validate_on_submit(): diff --git a/app/dashboard/views/fido_setup.py b/app/dashboard/views/fido_setup.py index 95b75b93..1dfbf16b 100644 --- a/app/dashboard/views/fido_setup.py +++ b/app/dashboard/views/fido_setup.py @@ -28,7 +28,7 @@ def fido_setup(): fido_token_form = FidoTokenForm() - rp_id = urlparse(SITE_URL).hostname + RP_ID = urlparse(SITE_URL).hostname # Handling POST requests if fido_token_form.validate_on_submit(): @@ -42,7 +42,7 @@ def fido_setup(): challenge = session['fido_challenge'] fido_reg_response = webauthn.WebAuthnRegistrationResponse( - rp_id, + RP_ID, SITE_URL, sk_assertion, challenge, @@ -70,7 +70,7 @@ def fido_setup(): challenge = secrets.token_urlsafe(32) credential_create_options = webauthn.WebAuthnMakeCredentialOptions( - challenge, 'Simple Login', rp_id, fido_uuid, + challenge, 'Simple Login', RP_ID, fido_uuid, current_user.email, current_user.name, False, attestation='none') # Don't think this one should be used, but it's not configurable by arguments