usso 0.28.16__tar.gz → 0.28.17__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 (35) hide show
  1. {usso-0.28.16/src/usso.egg-info → usso-0.28.17}/PKG-INFO +1 -1
  2. {usso-0.28.16 → usso-0.28.17}/pyproject.toml +1 -1
  3. {usso-0.28.16 → usso-0.28.17}/src/usso/auth/api_key.py +4 -7
  4. {usso-0.28.16 → usso-0.28.17}/src/usso/auth/client.py +4 -1
  5. {usso-0.28.16 → usso-0.28.17}/src/usso/auth/config.py +1 -1
  6. {usso-0.28.16 → usso-0.28.17/src/usso.egg-info}/PKG-INFO +1 -1
  7. {usso-0.28.16 → usso-0.28.17}/LICENSE.txt +0 -0
  8. {usso-0.28.16 → usso-0.28.17}/MANIFEST.in +0 -0
  9. {usso-0.28.16 → usso-0.28.17}/README.md +0 -0
  10. {usso-0.28.16 → usso-0.28.17}/pytest.ini +0 -0
  11. {usso-0.28.16 → usso-0.28.17}/setup.cfg +0 -0
  12. {usso-0.28.16 → usso-0.28.17}/src/usso/__init__.py +0 -0
  13. {usso-0.28.16 → usso-0.28.17}/src/usso/auth/__init__.py +0 -0
  14. {usso-0.28.16 → usso-0.28.17}/src/usso/auth/authorization.py +0 -0
  15. {usso-0.28.16 → usso-0.28.17}/src/usso/exceptions.py +0 -0
  16. {usso-0.28.16 → usso-0.28.17}/src/usso/integrations/django/__init__.py +0 -0
  17. {usso-0.28.16 → usso-0.28.17}/src/usso/integrations/django/middleware.py +0 -0
  18. {usso-0.28.16 → usso-0.28.17}/src/usso/integrations/fastapi/__init__.py +0 -0
  19. {usso-0.28.16 → usso-0.28.17}/src/usso/integrations/fastapi/dependency.py +0 -0
  20. {usso-0.28.16 → usso-0.28.17}/src/usso/integrations/fastapi/handler.py +0 -0
  21. {usso-0.28.16 → usso-0.28.17}/src/usso/models/user.py +0 -0
  22. {usso-0.28.16 → usso-0.28.17}/src/usso/session/__init__.py +0 -0
  23. {usso-0.28.16 → usso-0.28.17}/src/usso/session/async_session.py +0 -0
  24. {usso-0.28.16 → usso-0.28.17}/src/usso/session/base_session.py +0 -0
  25. {usso-0.28.16 → usso-0.28.17}/src/usso/session/session.py +0 -0
  26. {usso-0.28.16 → usso-0.28.17}/src/usso/utils/__init__.py +0 -0
  27. {usso-0.28.16 → usso-0.28.17}/src/usso/utils/method_utils.py +0 -0
  28. {usso-0.28.16 → usso-0.28.17}/src/usso/utils/string_utils.py +0 -0
  29. {usso-0.28.16 → usso-0.28.17}/src/usso.egg-info/SOURCES.txt +0 -0
  30. {usso-0.28.16 → usso-0.28.17}/src/usso.egg-info/dependency_links.txt +0 -0
  31. {usso-0.28.16 → usso-0.28.17}/src/usso.egg-info/entry_points.txt +0 -0
  32. {usso-0.28.16 → usso-0.28.17}/src/usso.egg-info/requires.txt +0 -0
  33. {usso-0.28.16 → usso-0.28.17}/src/usso.egg-info/top_level.txt +0 -0
  34. {usso-0.28.16 → usso-0.28.17}/tests/test_authorization.py +0 -0
  35. {usso-0.28.16 → usso-0.28.17}/tests/test_fastapi.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: usso
3
- Version: 0.28.16
3
+ Version: 0.28.17
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,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "usso"
7
- version = "0.28.16"
7
+ version = "0.28.17"
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"
@@ -1,5 +1,4 @@
1
1
  import logging
2
- from urllib.parse import urlparse
3
2
 
4
3
  import cachetools.func
5
4
  import httpx
@@ -19,12 +18,12 @@ def _handle_exception(error_type: str, **kwargs):
19
18
  logger.error(kwargs.get("message") or error_type)
20
19
 
21
20
 
22
- @cachetools.func.ttl_cache(maxsize=128, ttl=10 * 60)
23
- def fetch_api_key_data(jwks_url: str, api_key: str):
21
+ @cachetools.func.ttl_cache(maxsize=128, ttl=60)
22
+ def fetch_api_key_data(api_key_verify_url: str, api_key: str):
24
23
  """Fetch user data using an API key.
25
24
 
26
25
  Args:
27
- jwks_url: The JWK URL to use for verification
26
+ api_key_verify_url: The API key verify URL to use for verification
28
27
  api_key: The API key to verify
29
28
 
30
29
  Returns:
@@ -34,9 +33,7 @@ def fetch_api_key_data(jwks_url: str, api_key: str):
34
33
  USSOException: If the API key is invalid or verification fails
35
34
  """
36
35
  try:
37
- parsed = urlparse(jwks_url)
38
- url = f"{parsed.scheme}://{parsed.netloc}/api_key/verify"
39
- response = httpx.post(url, json={"api_key": api_key})
36
+ response = httpx.post(api_key_verify_url, json={"api_key": api_key})
40
37
  response.raise_for_status()
41
38
  return UserData(**response.json())
42
39
  except Exception as e:
@@ -87,4 +87,7 @@ class UssoAuth:
87
87
  Raises:
88
88
  USSOException: If the API key is invalid
89
89
  """
90
- return fetch_api_key_data(self.jwt_configs[0].jwks_url, api_key)
90
+ return fetch_api_key_data(
91
+ self.jwt_configs[0].api_key_header.verify_endpoint,
92
+ api_key,
93
+ )
@@ -42,7 +42,7 @@ class HeaderConfig(BaseModel):
42
42
 
43
43
 
44
44
  class APIHeaderConfig(HeaderConfig):
45
- verify_endpoint: str = "https://sso.usso.io/api_key/verify"
45
+ verify_endpoint: str = "https://sso.usso.io/api/sso/v1/apikeys/verify"
46
46
 
47
47
 
48
48
  class AuthConfig(usso_jwt.config.JWTConfig):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: usso
3
- Version: 0.28.16
3
+ Version: 0.28.17
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>
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