usso 0.21.0__py3-none-any.whl → 0.21.1__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.
usso/session.py CHANGED
@@ -1,4 +1,6 @@
1
+ from datetime import datetime
1
2
  import requests
3
+ import jwt
2
4
 
3
5
 
4
6
  class UssoSession:
@@ -20,6 +22,11 @@ class UssoSession:
20
22
  return response.json()
21
23
 
22
24
  def get_session(self):
25
+ if self.access_token:
26
+ decoded_token = jwt.decode(self.access_token, options={"verify_signature": False})
27
+ exp = datetime.fromtimestamp(decoded_token.get("exp"))
28
+ if exp < datetime.now():
29
+ self.access_token = None
23
30
  if not self.access_token:
24
31
  self.access_token = self._refresh()["access_token"]
25
32
  self.session.headers.update(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: usso
3
- Version: 0.21.0
3
+ Version: 0.21.1
4
4
  Summary: A plug-and-play client for integrating universal single sign-on (SSO) with Python frameworks, enabling secure and seamless authentication across microservices.
5
5
  Author-email: Mahdi Kiani <mahdikiany@gmail.com>
6
6
  Maintainer-email: Mahdi Kiani <mahdikiany@gmail.com>
@@ -4,12 +4,12 @@ usso/b64tools.py,sha256=7lsz_Rn6PITkKWfjcebmewdhvFs2A7H4t_WE33MgZ0Y,626
4
4
  usso/core.py,sha256=SCoN3GmUpj-AK6iFhmKquldfsiXtpJ6whGWKzk5NYFo,3950
5
5
  usso/exceptions.py,sha256=hawOAuVbvQtjgRfwp1KFZ4SmV7fh720y5Gom9JVA8W8,504
6
6
  usso/package_data.dat,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- usso/session.py,sha256=uj2iECBTtw3OJ_xflVkmutIrXCYQ-ag8WC_qB3IcDIs,842
7
+ usso/session.py,sha256=628drsoN0WTPZCiBAHKQUQcWlQuUnsEzvDkQ0uyVPRA,1153
8
8
  usso/fastapi/__init__.py,sha256=TRTDVJo8bwZQDAuCQFhh-g1XbIspf6TdFYXGAO5cgAU,130
9
9
  usso/fastapi/integration.py,sha256=NnySMqa-IKKYCi89m8Nrj2CD5xhBN_Kta74_Z_7FTI0,1817
10
- usso-0.21.0.dist-info/LICENSE.txt,sha256=ceC9ZJOV9H6CtQDcYmHOS46NA3dHJ_WD4J9blH513pc,1081
11
- usso-0.21.0.dist-info/METADATA,sha256=74pS6SLw2Av0An2kW0FtWdx2IgQwf4UZfHbrk-mGElE,4234
12
- usso-0.21.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
13
- usso-0.21.0.dist-info/entry_points.txt,sha256=4Zgpm5ELaAWPf0jPGJFz1_X69H7un8ycT3WdGoJ0Vvk,35
14
- usso-0.21.0.dist-info/top_level.txt,sha256=g9Jf6h1Oyidh0vPiFni7UHInTJjSvu6cUalpLTIvthg,5
15
- usso-0.21.0.dist-info/RECORD,,
10
+ usso-0.21.1.dist-info/LICENSE.txt,sha256=ceC9ZJOV9H6CtQDcYmHOS46NA3dHJ_WD4J9blH513pc,1081
11
+ usso-0.21.1.dist-info/METADATA,sha256=1IKuybfnEHHVMo-LrcO8Pfwb3sox50M9qpXKpjEuTUY,4234
12
+ usso-0.21.1.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
13
+ usso-0.21.1.dist-info/entry_points.txt,sha256=4Zgpm5ELaAWPf0jPGJFz1_X69H7un8ycT3WdGoJ0Vvk,35
14
+ usso-0.21.1.dist-info/top_level.txt,sha256=g9Jf6h1Oyidh0vPiFni7UHInTJjSvu6cUalpLTIvthg,5
15
+ usso-0.21.1.dist-info/RECORD,,
File without changes