From b606be8d31efa68bd99b014ca67092695efc8ffe Mon Sep 17 00:00:00 2001 From: James Meakin <12661555+jmsmkn@users.noreply.github.com> Date: Wed, 20 Nov 2024 10:46:56 +0100 Subject: [PATCH] Fix AuthTokens (#176) --- tests/scripts/create_test_fixtures.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tests/scripts/create_test_fixtures.py b/tests/scripts/create_test_fixtures.py index bf6cad7..7b06cbb 100644 --- a/tests/scripts/create_test_fixtures.py +++ b/tests/scripts/create_test_fixtures.py @@ -34,8 +34,7 @@ ) from grandchallenge.verifications.models import Verification from grandchallenge.workstations.models import Workstation -from knox import crypto -from knox.models import AuthToken +from knox.models import AuthToken, hash_token from knox.settings import CONSTANTS from .constants import USER_TOKENS @@ -227,11 +226,9 @@ def _create_archive(users): def _create_user_tokens(users): out = f"{'*' * 80}\n" for user, token in USER_TOKENS.items(): - digest = crypto.hash_token(token) - AuthToken( token_key=token[: CONSTANTS.TOKEN_KEY_LENGTH], - digest=digest, + key=hash_token(token), user=users[user], expiry=None, ).save()