usso 0.28.6__tar.gz → 0.28.9__tar.gz

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.
Files changed (33) hide show
  1. {usso-0.28.6/src/usso.egg-info → usso-0.28.9}/PKG-INFO +2 -2
  2. {usso-0.28.6 → usso-0.28.9}/pyproject.toml +9 -18
  3. {usso-0.28.6 → usso-0.28.9}/src/usso/session/async_session.py +11 -5
  4. {usso-0.28.6 → usso-0.28.9}/src/usso/session/session.py +6 -4
  5. {usso-0.28.6 → usso-0.28.9/src/usso.egg-info}/PKG-INFO +2 -2
  6. {usso-0.28.6 → usso-0.28.9}/src/usso.egg-info/requires.txt +1 -1
  7. {usso-0.28.6 → usso-0.28.9}/LICENSE.txt +0 -0
  8. {usso-0.28.6 → usso-0.28.9}/MANIFEST.in +0 -0
  9. {usso-0.28.6 → usso-0.28.9}/README.md +0 -0
  10. {usso-0.28.6 → usso-0.28.9}/pytest.ini +0 -0
  11. {usso-0.28.6 → usso-0.28.9}/setup.cfg +0 -0
  12. {usso-0.28.6 → usso-0.28.9}/src/usso/__init__.py +0 -0
  13. {usso-0.28.6 → usso-0.28.9}/src/usso/auth/__init__.py +0 -0
  14. {usso-0.28.6 → usso-0.28.9}/src/usso/auth/api_key.py +0 -0
  15. {usso-0.28.6 → usso-0.28.9}/src/usso/auth/client.py +0 -0
  16. {usso-0.28.6 → usso-0.28.9}/src/usso/auth/config.py +0 -0
  17. {usso-0.28.6 → usso-0.28.9}/src/usso/exceptions.py +0 -0
  18. {usso-0.28.6 → usso-0.28.9}/src/usso/integrations/django/__init__.py +0 -0
  19. {usso-0.28.6 → usso-0.28.9}/src/usso/integrations/django/middleware.py +0 -0
  20. {usso-0.28.6 → usso-0.28.9}/src/usso/integrations/fastapi/__init__.py +0 -0
  21. {usso-0.28.6 → usso-0.28.9}/src/usso/integrations/fastapi/dependency.py +0 -0
  22. {usso-0.28.6 → usso-0.28.9}/src/usso/integrations/fastapi/handler.py +0 -0
  23. {usso-0.28.6 → usso-0.28.9}/src/usso/models/user.py +0 -0
  24. {usso-0.28.6 → usso-0.28.9}/src/usso/session/__init__.py +0 -0
  25. {usso-0.28.6 → usso-0.28.9}/src/usso/session/base_session.py +0 -0
  26. {usso-0.28.6 → usso-0.28.9}/src/usso/utils/__init__.py +0 -0
  27. {usso-0.28.6 → usso-0.28.9}/src/usso/utils/method_utils.py +0 -0
  28. {usso-0.28.6 → usso-0.28.9}/src/usso/utils/string_utils.py +0 -0
  29. {usso-0.28.6 → usso-0.28.9}/src/usso.egg-info/SOURCES.txt +0 -0
  30. {usso-0.28.6 → usso-0.28.9}/src/usso.egg-info/dependency_links.txt +0 -0
  31. {usso-0.28.6 → usso-0.28.9}/src/usso.egg-info/entry_points.txt +0 -0
  32. {usso-0.28.6 → usso-0.28.9}/src/usso.egg-info/top_level.txt +0 -0
  33. {usso-0.28.6 → usso-0.28.9}/tests/test_fastapi.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: usso
3
- Version: 0.28.6
3
+ Version: 0.28.9
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>
@@ -28,7 +28,7 @@ Requires-Dist: cachetools
28
28
  Requires-Dist: singleton_package
29
29
  Requires-Dist: json-advanced
30
30
  Requires-Dist: httpx
31
- Requires-Dist: usso-jwt>=0.1.15
31
+ Requires-Dist: usso-jwt>=0.1.16
32
32
  Provides-Extra: fastapi
33
33
  Requires-Dist: fastapi>=0.65.0; extra == "fastapi"
34
34
  Requires-Dist: uvicorn[standard]>=0.13.0; extra == "fastapi"
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "usso"
7
- version = "0.28.6"
7
+ version = "0.28.9"
8
8
  description = "A plug-and-play client for integrating universal single sign-on (SSO) with Python frameworks, enabling secure and seamless authentication across microservices."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -30,24 +30,15 @@ dependencies = [
30
30
  "singleton_package",
31
31
  "json-advanced",
32
32
  "httpx",
33
- "usso-jwt>=0.1.15",
33
+ "usso-jwt>=0.1.16",
34
34
  ]
35
- optional-dependencies = { "fastapi" = [
36
- "fastapi>=0.65.0",
37
- "uvicorn[standard]>=0.13.0",
38
- ], "django" = [
39
- "Django>=3.2",
40
- ], "dev" = [
41
- "check-manifest",
42
- ], "test" = [
43
- "coverage",
44
- ], "all" = [
45
- "fastapi",
46
- "uvicorn",
47
- "django",
48
- "dev",
49
- "test",
50
- ] }
35
+
36
+ [project.optional-dependencies]
37
+ fastapi = ["fastapi>=0.65.0", "uvicorn[standard]>=0.13.0"]
38
+ django = ["Django>=3.2"]
39
+ dev = ["check-manifest"]
40
+ test = ["coverage"]
41
+ all = ["fastapi", "uvicorn", "django", "dev", "test"]
51
42
 
52
43
  [project.urls]
53
44
  "Homepage" = "https://github.com/ussoio/usso-python"
@@ -1,8 +1,8 @@
1
1
  import os
2
2
 
3
3
  import httpx
4
+ from usso_jwt.schemas import JWT, JWTConfig
4
5
 
5
- from ..core import is_expired
6
6
  from .base_session import BaseUssoSession
7
7
 
8
8
 
@@ -49,9 +49,15 @@ class AsyncUssoSession(httpx.AsyncClient, BaseUssoSession):
49
49
  Helper function to process the response from refresh requests.
50
50
  """
51
51
  response.raise_for_status()
52
- data = response.json()
53
- self.access_token = data.get("access_token")
54
- self._refresh_token = data.get("token", {}).get("refresh_token")
52
+ data: dict[str, str | dict[str, str]] = response.json()
53
+ self.access_token = JWT(
54
+ token=data.get("access_token"),
55
+ config=JWTConfig(jwk_url=f"{self.usso_url}/website/jwks.json"),
56
+ )
57
+ self._refresh_token = JWT(
58
+ token=data.get("token", {}).get("refresh_token"),
59
+ config=JWTConfig(jwk_url=f"{self.usso_url}/website/jwks.json"),
60
+ )
55
61
  if self.access_token:
56
62
  self.headers.update({
57
63
  "Authorization": f"Bearer {self.access_token}"
@@ -98,7 +104,7 @@ class AsyncUssoSession(httpx.AsyncClient, BaseUssoSession):
98
104
  if hasattr(self, "api_key") and self.api_key:
99
105
  return self
100
106
 
101
- if not self.access_token or is_expired(self.access_token):
107
+ if not self.access_token or self.access_token.is_temporally_valid():
102
108
  await self._refresh()
103
109
  return self
104
110
 
@@ -1,8 +1,7 @@
1
1
  import os
2
2
 
3
3
  import httpx
4
-
5
- from usso.core import is_expired
4
+ from usso_jwt.schemas import JWT, JWTConfig
6
5
 
7
6
  from .base_session import BaseUssoSession
8
7
 
@@ -37,7 +36,10 @@ class UssoSession(httpx.Client, BaseUssoSession):
37
36
  json={"refresh_token": f"{self.refresh_token}"},
38
37
  )
39
38
  response.raise_for_status()
40
- self.access_token = response.json().get("access_token")
39
+ self.access_token = JWT(
40
+ token=response.json().get("access_token"),
41
+ config=JWTConfig(jwk_url=f"{self.usso_url}/website/jwks.json"),
42
+ )
41
43
  self.headers.update({"Authorization": f"Bearer {self.access_token}"})
42
44
  return response.json()
43
45
 
@@ -45,7 +47,7 @@ class UssoSession(httpx.Client, BaseUssoSession):
45
47
  if self.api_key:
46
48
  return self
47
49
 
48
- if not self.access_token or is_expired(self.access_token):
50
+ if not self.access_token or self.access_token.is_temporally_valid():
49
51
  self._refresh()
50
52
  return self
51
53
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: usso
3
- Version: 0.28.6
3
+ Version: 0.28.9
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>
@@ -28,7 +28,7 @@ Requires-Dist: cachetools
28
28
  Requires-Dist: singleton_package
29
29
  Requires-Dist: json-advanced
30
30
  Requires-Dist: httpx
31
- Requires-Dist: usso-jwt>=0.1.15
31
+ Requires-Dist: usso-jwt>=0.1.16
32
32
  Provides-Extra: fastapi
33
33
  Requires-Dist: fastapi>=0.65.0; extra == "fastapi"
34
34
  Requires-Dist: uvicorn[standard]>=0.13.0; extra == "fastapi"
@@ -4,7 +4,7 @@ cachetools
4
4
  singleton_package
5
5
  json-advanced
6
6
  httpx
7
- usso-jwt>=0.1.15
7
+ usso-jwt>=0.1.16
8
8
 
9
9
  [all]
10
10
  fastapi
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes