usso 0.24.3__py3-none-any.whl → 0.24.5__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/django/middleware.py CHANGED
@@ -19,13 +19,14 @@ class USSOAuthenticationMiddleware(MiddlewareMixin):
19
19
  Middleware to authenticate users by JWT token and create or return a user in the database.
20
20
  """
21
21
  try:
22
- if request.user.is_authenticated:
22
+ if hasattr(request, "user") and request.user.is_authenticated:
23
23
  return
24
24
 
25
25
  user_data = self.jwt_access_security_none(request)
26
26
  if user_data:
27
27
  user = self.get_or_create_user(user_data)
28
28
  request.user = user
29
+ request._dont_enforce_csrf_checks = True
29
30
  except USSOException as e:
30
31
  # Handle any errors raised by USSO authentication
31
32
  return JsonResponse({"error": str(e)}, status=401)
@@ -11,6 +11,8 @@ logger = logging.getLogger("usso")
11
11
 
12
12
  def get_request_token(request: Request | WebSocket) -> UserData | None:
13
13
  authorization = request.headers.get("Authorization")
14
+ token = None
15
+
14
16
  if authorization:
15
17
  scheme, credentials = Usso().get_authorization_scheme_param(authorization)
16
18
  if scheme.lower() == "bearer":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: usso
3
- Version: 0.24.3
3
+ Version: 0.24.5
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>
@@ -8,12 +8,12 @@ usso/exceptions.py,sha256=hawOAuVbvQtjgRfwp1KFZ4SmV7fh720y5Gom9JVA8W8,504
8
8
  usso/package_data.dat,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  usso/session.py,sha256=S3dFXzar0Pcwxj5TGqadKwGdmzmzgp4H2W3brfOwJ6A,1184
10
10
  usso/django/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
11
- usso/django/middleware.py,sha256=gmLPbbcoMQqoqOl3InZwOhlUfI13MrPf2B6fCJrbeHw,3159
11
+ usso/django/middleware.py,sha256=EEEpHvMQ6QiWw2HY8zQ2Aec0RCATcLWsCKeyiPWJKio,3245
12
12
  usso/fastapi/__init__.py,sha256=TRTDVJo8bwZQDAuCQFhh-g1XbIspf6TdFYXGAO5cgAU,130
13
- usso/fastapi/integration.py,sha256=Lt3qRwQ59K7GCDHgB0dE0hpc18gYZEjwMb_xS4qsGg0,1651
14
- usso-0.24.3.dist-info/LICENSE.txt,sha256=ceC9ZJOV9H6CtQDcYmHOS46NA3dHJ_WD4J9blH513pc,1081
15
- usso-0.24.3.dist-info/METADATA,sha256=MfFSi6Bn3qxmUo-LDUJZHGIgCGWqaTDvLqvber8I5hc,4231
16
- usso-0.24.3.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
17
- usso-0.24.3.dist-info/entry_points.txt,sha256=4Zgpm5ELaAWPf0jPGJFz1_X69H7un8ycT3WdGoJ0Vvk,35
18
- usso-0.24.3.dist-info/top_level.txt,sha256=g9Jf6h1Oyidh0vPiFni7UHInTJjSvu6cUalpLTIvthg,5
19
- usso-0.24.3.dist-info/RECORD,,
13
+ usso/fastapi/integration.py,sha256=qu2HBsm4hPzM-fctO5rGZAHH2Lo8fk5U0K1jcEGDt2U,1673
14
+ usso-0.24.5.dist-info/LICENSE.txt,sha256=ceC9ZJOV9H6CtQDcYmHOS46NA3dHJ_WD4J9blH513pc,1081
15
+ usso-0.24.5.dist-info/METADATA,sha256=Zgrd7RW4gXMNa6y5rIYCIzfNLrvkE8xJBORwjgbAzr4,4231
16
+ usso-0.24.5.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
17
+ usso-0.24.5.dist-info/entry_points.txt,sha256=4Zgpm5ELaAWPf0jPGJFz1_X69H7un8ycT3WdGoJ0Vvk,35
18
+ usso-0.24.5.dist-info/top_level.txt,sha256=g9Jf6h1Oyidh0vPiFni7UHInTJjSvu6cUalpLTIvthg,5
19
+ usso-0.24.5.dist-info/RECORD,,
File without changes