the37lab-authlib 0.1.1751371611__py3-none-any.whl → 0.1.1755164205__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of the37lab-authlib might be problematic. Click here for more details.
- the37lab_authlib/auth.py +7 -2
- {the37lab_authlib-0.1.1751371611.dist-info → the37lab_authlib-0.1.1755164205.dist-info}/METADATA +1 -1
- {the37lab_authlib-0.1.1751371611.dist-info → the37lab_authlib-0.1.1755164205.dist-info}/RECORD +5 -5
- {the37lab_authlib-0.1.1751371611.dist-info → the37lab_authlib-0.1.1755164205.dist-info}/WHEEL +0 -0
- {the37lab_authlib-0.1.1751371611.dist-info → the37lab_authlib-0.1.1755164205.dist-info}/top_level.txt +0 -0
the37lab_authlib/auth.py
CHANGED
|
@@ -11,6 +11,7 @@ import bcrypt
|
|
|
11
11
|
import logging
|
|
12
12
|
import os
|
|
13
13
|
from functools import wraps
|
|
14
|
+
from isodate import parse_duration
|
|
14
15
|
|
|
15
16
|
logging.basicConfig(level=logging.DEBUG)
|
|
16
17
|
logger = logging.getLogger(__name__)
|
|
@@ -40,6 +41,10 @@ class AuthManager:
|
|
|
40
41
|
user_override_env = os.getenv(f'{prefix}USER_OVERRIDE')
|
|
41
42
|
if user_override_env:
|
|
42
43
|
self.user_override = user_override_env
|
|
44
|
+
else:
|
|
45
|
+
prefix = ''
|
|
46
|
+
|
|
47
|
+
self.expiry_time = parse_duration(os.getenv(f'{prefix}JWT_TOKEN_EXPIRY_TIME', 'PT1H'))
|
|
43
48
|
if self.user_override and (api_tokens or db_dsn):
|
|
44
49
|
raise ValueError('Cannot set user_override together with api_tokens or db_dsn')
|
|
45
50
|
if api_tokens and db_dsn:
|
|
@@ -487,12 +492,12 @@ class AuthManager:
|
|
|
487
492
|
def _create_token(self, user):
|
|
488
493
|
payload = {
|
|
489
494
|
'sub': str(user['id']),
|
|
490
|
-
'exp': datetime.utcnow() +
|
|
495
|
+
'exp': datetime.utcnow() + self.expiry_time,
|
|
491
496
|
'iat': datetime.utcnow()
|
|
492
497
|
}
|
|
493
498
|
logger.debug(f"Creating token with payload: {payload}")
|
|
494
499
|
token = jwt.encode(payload, self.jwt_secret, algorithm='HS256')
|
|
495
|
-
logger.
|
|
500
|
+
logger.info(f"Created token: {token}")
|
|
496
501
|
return token
|
|
497
502
|
|
|
498
503
|
def _create_refresh_token(self, user):
|
{the37lab_authlib-0.1.1751371611.dist-info → the37lab_authlib-0.1.1755164205.dist-info}/RECORD
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
the37lab_authlib/__init__.py,sha256=cFVTWL-0YIMqwOMVy1P8mOt_bQODJp-L9bfp2QQ8CTo,132
|
|
2
|
-
the37lab_authlib/auth.py,sha256=
|
|
2
|
+
the37lab_authlib/auth.py,sha256=eAeyS9wBO7euMkbnRZH8mvaUzy06KbQ3qwckOtmjhkw,23536
|
|
3
3
|
the37lab_authlib/db.py,sha256=fTXxnfju0lmbFGPVbXpTMeDmJMeBgURVZTndyxyRyCc,2734
|
|
4
4
|
the37lab_authlib/decorators.py,sha256=L-gJUUwDUT2JXTptQ6XEey1LkI5RprbqzEfArWI7F8Y,1305
|
|
5
5
|
the37lab_authlib/exceptions.py,sha256=mdplK5sKNtagPAzSGq5NGsrQ4r-k03DKJBKx6myWwZc,317
|
|
6
6
|
the37lab_authlib/models.py,sha256=-PlvQlHGIsSdrH0H9Cdh_vTPlltGV8G1Z1mmGQvAg9Y,3422
|
|
7
|
-
the37lab_authlib-0.1.
|
|
8
|
-
the37lab_authlib-0.1.
|
|
9
|
-
the37lab_authlib-0.1.
|
|
10
|
-
the37lab_authlib-0.1.
|
|
7
|
+
the37lab_authlib-0.1.1755164205.dist-info/METADATA,sha256=pne_IT3gqIEhM6AAf8vF6bBUNOecqSUl_2RsgwQuggA,8319
|
|
8
|
+
the37lab_authlib-0.1.1755164205.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
9
|
+
the37lab_authlib-0.1.1755164205.dist-info/top_level.txt,sha256=6Jmxw4UeLrhfJXgRKbXWY4OhxRSaMs0dKKhNCGWWSwc,17
|
|
10
|
+
the37lab_authlib-0.1.1755164205.dist-info/RECORD,,
|
{the37lab_authlib-0.1.1751371611.dist-info → the37lab_authlib-0.1.1755164205.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|