Skip to content

Commit

Permalink
Fix AuthTokens (#176)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmsmkn authored Nov 20, 2024
1 parent ad9f6ff commit b606be8
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions tests/scripts/create_test_fixtures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit b606be8

Please sign in to comment.