usso 0.25.2__py3-none-any.whl → 0.25.3__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/core.py CHANGED
@@ -188,7 +188,16 @@ class Usso:
188
188
  exp = None
189
189
  for jwk_config in self.jwt_configs:
190
190
  try:
191
- return jwk_config.decode(token)
191
+ user_data = jwk_config.decode(token)
192
+ if user_data.token_type.lower() != kwargs.get("token_type", "access"):
193
+ raise USSOException(
194
+ status_code=401,
195
+ error="invalid_token_type",
196
+ message="Token type must be 'access'",
197
+ )
198
+
199
+ return user_data
200
+
192
201
  except USSOException as e:
193
202
  exp = e
194
203
 
@@ -5,7 +5,7 @@ from starlette.status import HTTP_401_UNAUTHORIZED
5
5
 
6
6
  from usso.exceptions import USSOException
7
7
 
8
- from ..core import UserData, Usso
8
+ from ..core import UserData, Usso, get_authorization_scheme_param
9
9
 
10
10
  logger = logging.getLogger("usso")
11
11
 
@@ -15,7 +15,7 @@ def get_request_token(request: Request | WebSocket) -> UserData | None:
15
15
  token = None
16
16
 
17
17
  if authorization:
18
- scheme, credentials = Usso().get_authorization_scheme_param(authorization)
18
+ scheme, credentials = get_authorization_scheme_param(authorization)
19
19
  if scheme.lower() == "bearer":
20
20
  token = credentials
21
21
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: usso
3
- Version: 0.25.2
3
+ Version: 0.25.3
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>
@@ -3,16 +3,16 @@ usso/api.py,sha256=xlDq2nZNpq3mhAvqIbGEfANHNjJpPquSeULBfS7iMJw,5094
3
3
  usso/async_api.py,sha256=rb-Xh5oudmZrPYM_iH_B75b5Z0Fvi1V1uurdcKE51w0,5551
4
4
  usso/async_session.py,sha256=nFIrtV3Tp0H-s2ZkMLU9_fVSeVGq1EtY1bGT_XOS5Vw,4336
5
5
  usso/b64tools.py,sha256=HGQ0E59vzjrQo2-4jrcY03ebtTaYwTtCZ7KgJaEmxO0,610
6
- usso/core.py,sha256=7DpJplPX8aWI4wSkd-gS58ss_G_Sgq5uRqbXiKOQgeo,6512
6
+ usso/core.py,sha256=I2Mxwfa3SAAIGMNCYhu7q9ejaS219Lz9O7h6zVBZYCI,6858
7
7
  usso/exceptions.py,sha256=hawOAuVbvQtjgRfwp1KFZ4SmV7fh720y5Gom9JVA8W8,504
8
8
  usso/session.py,sha256=Lky2O8FGbOMJFOMxxdE0rhpgwWKThGQfr-X9YQsFpLk,2358
9
9
  usso/django/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  usso/django/middleware.py,sha256=EEEpHvMQ6QiWw2HY8zQ2Aec0RCATcLWsCKeyiPWJKio,3245
11
11
  usso/fastapi/__init__.py,sha256=0EcdOzb4f3yu9nILIdGWnlyUz-0VaVX2az1e3f2BusI,201
12
- usso/fastapi/integration.py,sha256=LNKd_KStKr5CBj_CUfwkrgtiY5R8nBL61FVBWcIrhQE,1667
13
- usso-0.25.2.dist-info/LICENSE.txt,sha256=ceC9ZJOV9H6CtQDcYmHOS46NA3dHJ_WD4J9blH513pc,1081
14
- usso-0.25.2.dist-info/METADATA,sha256=RgDkN68nTqjXyUjX8LHcC20MFMuM7kyilJqxrI5Oyqw,4194
15
- usso-0.25.2.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
16
- usso-0.25.2.dist-info/entry_points.txt,sha256=4Zgpm5ELaAWPf0jPGJFz1_X69H7un8ycT3WdGoJ0Vvk,35
17
- usso-0.25.2.dist-info/top_level.txt,sha256=g9Jf6h1Oyidh0vPiFni7UHInTJjSvu6cUalpLTIvthg,5
18
- usso-0.25.2.dist-info/RECORD,,
12
+ usso/fastapi/integration.py,sha256=tvf_oD7x6y0gVmW_BwJkYI-UO5LIMpWxJsh2IPBftlM,1692
13
+ usso-0.25.3.dist-info/LICENSE.txt,sha256=ceC9ZJOV9H6CtQDcYmHOS46NA3dHJ_WD4J9blH513pc,1081
14
+ usso-0.25.3.dist-info/METADATA,sha256=cfBtCQXLYFdZIri1-KHwzoTuYgxQM2HdS6qTAOYW2wc,4194
15
+ usso-0.25.3.dist-info/WHEEL,sha256=OVMc5UfuAQiSplgO0_WdW7vXVGAt9Hdd6qtN4HotdyA,91
16
+ usso-0.25.3.dist-info/entry_points.txt,sha256=4Zgpm5ELaAWPf0jPGJFz1_X69H7un8ycT3WdGoJ0Vvk,35
17
+ usso-0.25.3.dist-info/top_level.txt,sha256=g9Jf6h1Oyidh0vPiFni7UHInTJjSvu6cUalpLTIvthg,5
18
+ usso-0.25.3.dist-info/RECORD,,
File without changes