beamlit 0.0.34rc72__py3-none-any.whl → 0.0.34rc73__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.
- beamlit/authentication/clientcredentials.py +5 -3
- beamlit/authentication/device_mode.py +4 -4
- {beamlit-0.0.34rc72.dist-info → beamlit-0.0.34rc73.dist-info}/METADATA +1 -1
- {beamlit-0.0.34rc72.dist-info → beamlit-0.0.34rc73.dist-info}/RECORD +5 -5
- {beamlit-0.0.34rc72.dist-info → beamlit-0.0.34rc73.dist-info}/WHEEL +0 -0
@@ -1,7 +1,7 @@
|
|
1
1
|
import base64
|
2
2
|
import json
|
3
|
-
import time
|
4
3
|
from dataclasses import dataclass
|
4
|
+
from datetime import datetime, timedelta
|
5
5
|
from typing import Generator, Optional
|
6
6
|
|
7
7
|
import requests
|
@@ -55,11 +55,13 @@ class ClientCredentials(Auth):
|
|
55
55
|
except Exception as e:
|
56
56
|
return Exception(f"Failed to decode/parse JWT claims: {str(e)}")
|
57
57
|
|
58
|
-
exp_time =
|
58
|
+
exp_time = datetime.fromtimestamp(claims["exp"])
|
59
|
+
current_time = datetime.now()
|
59
60
|
# Refresh if token expires in less than 10 minutes
|
60
|
-
if
|
61
|
+
if current_time + timedelta(minutes=10) > exp_time:
|
61
62
|
return self.do_refresh()
|
62
63
|
|
64
|
+
|
63
65
|
return None
|
64
66
|
|
65
67
|
def auth_flow(self, request: Request) -> Generator[Request, Response, None]:
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import base64
|
2
2
|
import json
|
3
|
-
import time
|
4
3
|
from dataclasses import dataclass
|
4
|
+
from datetime import datetime, timedelta
|
5
5
|
from typing import Dict, Generator, Optional
|
6
6
|
|
7
7
|
from httpx import Auth, Request, Response, post
|
@@ -65,10 +65,10 @@ class BearerToken(Auth):
|
|
65
65
|
claims = json.loads(claims_bytes)
|
66
66
|
except Exception as e:
|
67
67
|
return Exception(f"Failed to decode/parse JWT claims: {str(e)}")
|
68
|
-
|
69
|
-
|
68
|
+
exp_time = datetime.fromtimestamp(claims["exp"])
|
69
|
+
current_time = datetime.now()
|
70
70
|
# Refresh if token expires in less than 10 minutes
|
71
|
-
if
|
71
|
+
if current_time + timedelta(minutes=10) > exp_time:
|
72
72
|
return self.do_refresh()
|
73
73
|
|
74
74
|
return None
|
@@ -125,9 +125,9 @@ beamlit/api/workspaces/update_workspace_user_role.py,sha256=Yn9iuJ4tKtauzBiJyU4-
|
|
125
125
|
beamlit/authentication/__init__.py,sha256=wiXqRbc7E-ulrH_ueA9duOGFvXeo7-RvhSD1XbFogMo,1020
|
126
126
|
beamlit/authentication/apikey.py,sha256=KNBTgdi0VBzBAAmSwU2X1QoB58vRbg8wkXb8-GTZCQo,657
|
127
127
|
beamlit/authentication/authentication.py,sha256=ODQCc00RvCOZNaiGG5ctylNnE-JVCugePyJedJ0NYsM,3361
|
128
|
-
beamlit/authentication/clientcredentials.py,sha256=
|
128
|
+
beamlit/authentication/clientcredentials.py,sha256=JFmnnE-jMyxKDvZbRlBsWsvCEnWQCO23pDknZVUK-u0,4069
|
129
129
|
beamlit/authentication/credentials.py,sha256=p_1xenabCbQuRz7BiFk7oTK4uCxAt_zoyku5o-jcKGE,5343
|
130
|
-
beamlit/authentication/device_mode.py,sha256=
|
130
|
+
beamlit/authentication/device_mode.py,sha256=LNHjoKe3u4TWApLKO34cJjN92UsVkHSYSbXr6eKxo64,3721
|
131
131
|
beamlit/common/__init__.py,sha256=saX5X3hRCJ9erSlXuSkZ2VGgquvpgdcofAU_9sM4bCE,354
|
132
132
|
beamlit/common/error.py,sha256=f9oJDFxhoHK-vpjxBgEp0NwWIk0N_THPemUI7uQxVzU,270
|
133
133
|
beamlit/common/instrumentation.py,sha256=8sbYCrkC_2BsdAZ_1cWTw5aRtMUz2xvN2tsG0rovBtA,5351
|
@@ -280,6 +280,6 @@ beamlit/serve/app.py,sha256=_aG2UVQ3Y85rUW3ehu9TlzLnowkfh54IIz558ftqOMw,3638
|
|
280
280
|
beamlit/serve/middlewares/__init__.py,sha256=1dVmnOmhAQWvWktqHkKSIX-YoF6fmMU8xkUQuhg_rJU,148
|
281
281
|
beamlit/serve/middlewares/accesslog.py,sha256=Mu4T4_9OvHybjA0ApzZFpgi2C8f3X1NbUk-76v634XM,631
|
282
282
|
beamlit/serve/middlewares/processtime.py,sha256=lDAaIasZ4bwvN-HKHvZpaD9r-yrkVNZYx4abvbjbrCg,411
|
283
|
-
beamlit-0.0.
|
284
|
-
beamlit-0.0.
|
285
|
-
beamlit-0.0.
|
283
|
+
beamlit-0.0.34rc73.dist-info/METADATA,sha256=uoKtfQYzjsQWmSyWYRtJZ_nG6S78XeEnFOrYgHu5ysI,2412
|
284
|
+
beamlit-0.0.34rc73.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
285
|
+
beamlit-0.0.34rc73.dist-info/RECORD,,
|
File without changes
|