usso 0.28.19__tar.gz → 0.28.20__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.19/src/usso.egg-info → usso-0.28.20}/PKG-INFO +1 -1
  2. {usso-0.28.19 → usso-0.28.20}/pyproject.toml +1 -1
  3. {usso-0.28.19 → usso-0.28.20}/src/usso/auth/authorization.py +16 -6
  4. {usso-0.28.19 → usso-0.28.20/src/usso.egg-info}/PKG-INFO +1 -1
  5. {usso-0.28.19 → usso-0.28.20}/tests/test_authorization.py +5 -0
  6. {usso-0.28.19 → usso-0.28.20}/LICENSE.txt +0 -0
  7. {usso-0.28.19 → usso-0.28.20}/MANIFEST.in +0 -0
  8. {usso-0.28.19 → usso-0.28.20}/README.md +0 -0
  9. {usso-0.28.19 → usso-0.28.20}/pytest.ini +0 -0
  10. {usso-0.28.19 → usso-0.28.20}/setup.cfg +0 -0
  11. {usso-0.28.19 → usso-0.28.20}/src/usso/__init__.py +0 -0
  12. {usso-0.28.19 → usso-0.28.20}/src/usso/auth/__init__.py +0 -0
  13. {usso-0.28.19 → usso-0.28.20}/src/usso/auth/api_key.py +0 -0
  14. {usso-0.28.19 → usso-0.28.20}/src/usso/auth/client.py +0 -0
  15. {usso-0.28.19 → usso-0.28.20}/src/usso/auth/config.py +0 -0
  16. {usso-0.28.19 → usso-0.28.20}/src/usso/exceptions.py +0 -0
  17. {usso-0.28.19 → usso-0.28.20}/src/usso/integrations/django/__init__.py +0 -0
  18. {usso-0.28.19 → usso-0.28.20}/src/usso/integrations/django/middleware.py +0 -0
  19. {usso-0.28.19 → usso-0.28.20}/src/usso/integrations/fastapi/__init__.py +0 -0
  20. {usso-0.28.19 → usso-0.28.20}/src/usso/integrations/fastapi/dependency.py +0 -0
  21. {usso-0.28.19 → usso-0.28.20}/src/usso/integrations/fastapi/handler.py +0 -0
  22. {usso-0.28.19 → usso-0.28.20}/src/usso/models/user.py +0 -0
  23. {usso-0.28.19 → usso-0.28.20}/src/usso/session/__init__.py +0 -0
  24. {usso-0.28.19 → usso-0.28.20}/src/usso/session/async_session.py +0 -0
  25. {usso-0.28.19 → usso-0.28.20}/src/usso/session/base_session.py +0 -0
  26. {usso-0.28.19 → usso-0.28.20}/src/usso/session/session.py +0 -0
  27. {usso-0.28.19 → usso-0.28.20}/src/usso/utils/__init__.py +0 -0
  28. {usso-0.28.19 → usso-0.28.20}/src/usso/utils/method_utils.py +0 -0
  29. {usso-0.28.19 → usso-0.28.20}/src/usso/utils/string_utils.py +0 -0
  30. {usso-0.28.19 → usso-0.28.20}/src/usso.egg-info/SOURCES.txt +0 -0
  31. {usso-0.28.19 → usso-0.28.20}/src/usso.egg-info/dependency_links.txt +0 -0
  32. {usso-0.28.19 → usso-0.28.20}/src/usso.egg-info/entry_points.txt +0 -0
  33. {usso-0.28.19 → usso-0.28.20}/src/usso.egg-info/requires.txt +0 -0
  34. {usso-0.28.19 → usso-0.28.20}/src/usso.egg-info/top_level.txt +0 -0
  35. {usso-0.28.19 → usso-0.28.20}/tests/test_fastapi.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: usso
3
- Version: 0.28.19
3
+ Version: 0.28.20
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.19"
7
+ version = "0.28.20"
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,6 +1,6 @@
1
1
  import fnmatch
2
2
  import logging
3
- from urllib.parse import parse_qs, urlparse
3
+ from urllib.parse import parse_qs
4
4
 
5
5
  PRIVILEGE_LEVELS = {
6
6
  "read": 10,
@@ -33,12 +33,22 @@ def parse_scope(scope: str) -> tuple[str, list[str], dict[str, str]]:
33
33
  - filters: dict[str, str]
34
34
  """
35
35
 
36
- parsed = urlparse(scope)
37
- path = parsed.path
38
- query = parsed.query
36
+ colon_idx = scope.find(":")
37
+ question_idx = scope.find("?")
38
+ if question_idx == -1:
39
+ question_idx = len(scope)
40
+
41
+ if colon_idx != -1 and colon_idx < question_idx:
42
+ action = scope[:colon_idx]
43
+ resource_path = scope[colon_idx + 1 : question_idx]
44
+ else:
45
+ action = ""
46
+ resource_path = scope[:question_idx]
47
+
48
+ query = scope[question_idx + 1 :]
39
49
  filters = {k: v[0] for k, v in parse_qs(query).items()}
40
- path_parts = path.split("/") if path else ["*"]
41
- return parsed.scheme, path_parts, filters
50
+ resource_path_parts = resource_path.split("/") if resource_path else ["*"]
51
+ return action, resource_path_parts, filters
42
52
 
43
53
 
44
54
  def is_path_match(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: usso
3
- Version: 0.28.19
3
+ Version: 0.28.20
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>
@@ -210,3 +210,8 @@ def test_scope_subset():
210
210
  assert not is_subset_scope(
211
211
  subset_scope="create:files", super_scope="files"
212
212
  )
213
+ assert not is_subset_scope(subset_scope="create:files", super_scope="*")
214
+ assert is_subset_scope(subset_scope="create:files", super_scope="*:*")
215
+ assert is_subset_scope(
216
+ subset_scope="create:files", super_scope="*://files"
217
+ )
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
File without changes