usso 0.28.25__tar.gz → 0.28.26__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.25/src/usso.egg-info → usso-0.28.26}/PKG-INFO +1 -1
  2. {usso-0.28.25 → usso-0.28.26}/pyproject.toml +1 -1
  3. {usso-0.28.25 → usso-0.28.26}/src/usso/authorization.py +13 -0
  4. {usso-0.28.25 → usso-0.28.26/src/usso.egg-info}/PKG-INFO +1 -1
  5. {usso-0.28.25 → usso-0.28.26}/tests/test_authorization.py +1 -0
  6. {usso-0.28.25 → usso-0.28.26}/LICENSE.txt +0 -0
  7. {usso-0.28.25 → usso-0.28.26}/MANIFEST.in +0 -0
  8. {usso-0.28.25 → usso-0.28.26}/README.md +0 -0
  9. {usso-0.28.25 → usso-0.28.26}/pytest.ini +0 -0
  10. {usso-0.28.25 → usso-0.28.26}/setup.cfg +0 -0
  11. {usso-0.28.25 → usso-0.28.26}/src/usso/__init__.py +0 -0
  12. {usso-0.28.25 → usso-0.28.26}/src/usso/api_key.py +0 -0
  13. {usso-0.28.25 → usso-0.28.26}/src/usso/client.py +0 -0
  14. {usso-0.28.25 → usso-0.28.26}/src/usso/config.py +0 -0
  15. {usso-0.28.25 → usso-0.28.26}/src/usso/exceptions.py +0 -0
  16. {usso-0.28.25 → usso-0.28.26}/src/usso/integrations/django/__init__.py +0 -0
  17. {usso-0.28.25 → usso-0.28.26}/src/usso/integrations/django/middleware.py +0 -0
  18. {usso-0.28.25 → usso-0.28.26}/src/usso/integrations/fastapi/__init__.py +0 -0
  19. {usso-0.28.25 → usso-0.28.26}/src/usso/integrations/fastapi/dependency.py +0 -0
  20. {usso-0.28.25 → usso-0.28.26}/src/usso/integrations/fastapi/handler.py +0 -0
  21. {usso-0.28.25 → usso-0.28.26}/src/usso/session/__init__.py +0 -0
  22. {usso-0.28.25 → usso-0.28.26}/src/usso/session/async_session.py +0 -0
  23. {usso-0.28.25 → usso-0.28.26}/src/usso/session/base_session.py +0 -0
  24. {usso-0.28.25 → usso-0.28.26}/src/usso/session/session.py +0 -0
  25. {usso-0.28.25 → usso-0.28.26}/src/usso/user.py +0 -0
  26. {usso-0.28.25 → usso-0.28.26}/src/usso/utils/__init__.py +0 -0
  27. {usso-0.28.25 → usso-0.28.26}/src/usso/utils/string_utils.py +0 -0
  28. {usso-0.28.25 → usso-0.28.26}/src/usso.egg-info/SOURCES.txt +0 -0
  29. {usso-0.28.25 → usso-0.28.26}/src/usso.egg-info/dependency_links.txt +0 -0
  30. {usso-0.28.25 → usso-0.28.26}/src/usso.egg-info/entry_points.txt +0 -0
  31. {usso-0.28.25 → usso-0.28.26}/src/usso.egg-info/requires.txt +0 -0
  32. {usso-0.28.25 → usso-0.28.26}/src/usso.egg-info/top_level.txt +0 -0
  33. {usso-0.28.25 → usso-0.28.26}/tests/test_fastapi.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: usso
3
- Version: 0.28.25
3
+ Version: 0.28.26
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.25"
7
+ version = "0.28.26"
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"
@@ -84,6 +84,7 @@ def is_path_match(
84
84
  ("files", "files/transactions", False),
85
85
  ("files", "media/files/transactions", False),
86
86
  ("media/files", "media/files/transactions", False),
87
+ ("finance/*/*", "wallet", False),
87
88
  ]
88
89
  """
89
90
  if isinstance(user_path, str):
@@ -100,10 +101,14 @@ def is_path_match(
100
101
  else:
101
102
  raise ValueError(f"Invalid path type: {type(requested_path)}")
102
103
 
104
+ wildcard_found = False
103
105
  # Match resource name (rightmost)
104
106
  if not fnmatch.fnmatch(req_parts[-1], user_parts[-1]):
105
107
  return False
106
108
 
109
+ if "*" in user_parts[-1]:
110
+ wildcard_found = True
111
+
107
112
  # Match rest of the path from right to left
108
113
  user_path_parts = user_parts[:-1]
109
114
  req_path_parts = req_parts[:-1]
@@ -115,6 +120,14 @@ def is_path_match(
115
120
  ):
116
121
  if r and u and r != "*" and not fnmatch.fnmatch(r, u):
117
122
  return False
123
+ if "*" in u:
124
+ wildcard_found = True
125
+
126
+ offset = len(user_path_parts) - len(req_path_parts)
127
+ if offset > 0 and wildcard_found:
128
+ for u in user_path_parts[-offset:]:
129
+ if u != "*":
130
+ return False
118
131
 
119
132
  return True
120
133
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: usso
3
- Version: 0.28.25
3
+ Version: 0.28.26
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>
@@ -34,6 +34,7 @@ from src.usso.authorization import (
34
34
  ("files", "files/transactions", False),
35
35
  ("files", "media/files/transactions", False),
36
36
  ("media/files", "media/files/transactions", False),
37
+ ("finance/*/*", "wallet", False),
37
38
  ],
38
39
  )
39
40
  def test_path_match(user_path, requested_path, expected):
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