Skip to content

Commit

Permalink
Merge pull request #287 from brukberhane/develop
Browse files Browse the repository at this point in the history
update AuthTokenManager to support custom values
  • Loading branch information
johnraz committed Jun 17, 2024
2 parents 01c1de4 + 3651a07 commit 0113d42
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions knox/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,16 @@ def create(
self,
user,
expiry=knox_settings.TOKEN_TTL,
prefix=knox_settings.TOKEN_PREFIX
prefix=knox_settings.TOKEN_PREFIX,
**kwargs
):
token = prefix + crypto.create_token_string()
digest = crypto.hash_token(token)
if expiry is not None:
expiry = timezone.now() + expiry
instance = super(AuthTokenManager, self).create(
token_key=token[:CONSTANTS.TOKEN_KEY_LENGTH], digest=digest,
user=user, expiry=expiry)
user=user, expiry=expiry, **kwargs)
return instance, token


Expand Down

0 comments on commit 0113d42

Please sign in to comment.