usso 0.28.16__py3-none-any.whl → 0.28.17__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/auth/api_key.py CHANGED
@@ -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:
usso/auth/client.py CHANGED
@@ -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
+ )
usso/auth/config.py CHANGED
@@ -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>
@@ -1,10 +1,10 @@
1
1
  usso/__init__.py,sha256=t3tYcw4qtGFpk7iakXTqEj5RlzIc8D2fs0I3FZcOmGs,571
2
2
  usso/exceptions.py,sha256=cBzmMCwpNQKMjCUXO3bCcFwZJQQvbvJ5RxTH987ZlCI,1012
3
3
  usso/auth/__init__.py,sha256=Dthv-iZTgsHTGcJrkJsnAtDCbRR5dNCx0Ut7MufoAXY,270
4
- usso/auth/api_key.py,sha256=cT0ZCMhr8mX3-tByocvhOmK0kkeFCMMGtd6cZdzIspA,1257
4
+ usso/auth/api_key.py,sha256=EIW9yCOu52EzF9I16yOmBHtIJQAXZ6YhMwJUsBtuWVA,1162
5
5
  usso/auth/authorization.py,sha256=HuNBgz0RSPMevPAhZdqsCpp-Uz1MrDM37KvC5utVwqU,5489
6
- usso/auth/client.py,sha256=BD4auDPCLoIPHIg8_JXjqFkc2a_6QrAxDkYjoB4416Q,2588
7
- usso/auth/config.py,sha256=wRMsR89tw_PbUY83ObuEMCWuj3_Y8gcuYj8yZ-PiDFs,3739
6
+ usso/auth/client.py,sha256=WFB7I9_fzr_P-oK_elaiCe5EIZZ9kY_LkkJls6BGWZk,2645
7
+ usso/auth/config.py,sha256=SQMr6Y0zJFA9jvx8UKKv6PPJ0GVBzlwKXfAhwQn2fjU,3750
8
8
  usso/integrations/django/__init__.py,sha256=dKpbffHS5ouGtW6ooI2ivzjPmH_1rOBny85htR-KqrY,97
9
9
  usso/integrations/django/middleware.py,sha256=AZKYZ4UPNmyxcD3ANgp0y_fdrFvVQdHBqyYxo5XhQUs,3445
10
10
  usso/integrations/fastapi/__init__.py,sha256=ohToiqutHu3Okr8naunssDkamj1OdiG4OpPdBW0rt7U,204
@@ -18,9 +18,9 @@ usso/session/session.py,sha256=briCgDMoF-b59H6Aie_Lmjy4qnPBBSmKnVhAwef34F0,1637
18
18
  usso/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
19
19
  usso/utils/method_utils.py,sha256=1NMN4le04PWXDSJZK-nf7q2IFqOMkwYcCnslFXAzlH8,355
20
20
  usso/utils/string_utils.py,sha256=7tziAa2Cwa7xhwM_NF4DSY3BHoqVaWgJ21VuV8LvhrY,253
21
- usso-0.28.16.dist-info/licenses/LICENSE.txt,sha256=ceC9ZJOV9H6CtQDcYmHOS46NA3dHJ_WD4J9blH513pc,1081
22
- usso-0.28.16.dist-info/METADATA,sha256=CwuJO02M13iJKbJc28gQ69WoJOFoz7MJS3aW8rTd0nQ,5061
23
- usso-0.28.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
24
- usso-0.28.16.dist-info/entry_points.txt,sha256=4Zgpm5ELaAWPf0jPGJFz1_X69H7un8ycT3WdGoJ0Vvk,35
25
- usso-0.28.16.dist-info/top_level.txt,sha256=g9Jf6h1Oyidh0vPiFni7UHInTJjSvu6cUalpLTIvthg,5
26
- usso-0.28.16.dist-info/RECORD,,
21
+ usso-0.28.17.dist-info/licenses/LICENSE.txt,sha256=ceC9ZJOV9H6CtQDcYmHOS46NA3dHJ_WD4J9blH513pc,1081
22
+ usso-0.28.17.dist-info/METADATA,sha256=j97abEMXXA2AWZiEXErWj2Yb5XmGSHv-JH-yyDWZaiQ,5061
23
+ usso-0.28.17.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
24
+ usso-0.28.17.dist-info/entry_points.txt,sha256=4Zgpm5ELaAWPf0jPGJFz1_X69H7un8ycT3WdGoJ0Vvk,35
25
+ usso-0.28.17.dist-info/top_level.txt,sha256=g9Jf6h1Oyidh0vPiFni7UHInTJjSvu6cUalpLTIvthg,5
26
+ usso-0.28.17.dist-info/RECORD,,
File without changes