usso 0.20.4__tar.gz → 0.20.6__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.
- {usso-0.20.4/src/usso.egg-info → usso-0.20.6}/PKG-INFO +2 -4
- {usso-0.20.4 → usso-0.20.6}/pyproject.toml +2 -4
- {usso-0.20.4 → usso-0.20.6}/src/usso/api.py +12 -8
- {usso-0.20.4 → usso-0.20.6/src/usso.egg-info}/PKG-INFO +2 -4
- {usso-0.20.4 → usso-0.20.6}/tests/test_core.py +6 -6
- {usso-0.20.4 → usso-0.20.6}/LICENSE.txt +0 -0
- {usso-0.20.4 → usso-0.20.6}/README.md +0 -0
- {usso-0.20.4 → usso-0.20.6}/setup.cfg +0 -0
- {usso-0.20.4 → usso-0.20.6}/src/usso/__init__.py +0 -0
- {usso-0.20.4 → usso-0.20.6}/src/usso/b64tools.py +0 -0
- {usso-0.20.4 → usso-0.20.6}/src/usso/core.py +0 -0
- {usso-0.20.4 → usso-0.20.6}/src/usso/exceptions.py +0 -0
- {usso-0.20.4 → usso-0.20.6}/src/usso/fastapi/__init__.py +0 -0
- {usso-0.20.4 → usso-0.20.6}/src/usso/fastapi/integration.py +0 -0
- {usso-0.20.4 → usso-0.20.6}/src/usso/package_data.dat +0 -0
- {usso-0.20.4 → usso-0.20.6}/src/usso.egg-info/SOURCES.txt +0 -0
- {usso-0.20.4 → usso-0.20.6}/src/usso.egg-info/dependency_links.txt +0 -0
- {usso-0.20.4 → usso-0.20.6}/src/usso.egg-info/entry_points.txt +0 -0
- {usso-0.20.4 → usso-0.20.6}/src/usso.egg-info/requires.txt +0 -0
- {usso-0.20.4 → usso-0.20.6}/src/usso.egg-info/top_level.txt +0 -0
- {usso-0.20.4 → usso-0.20.6}/tests/test_api.py +0 -0
- {usso-0.20.4 → usso-0.20.6}/tests/test_simple.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: usso
|
3
|
-
Version: 0.20.
|
3
|
+
Version: 0.20.6
|
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>
|
@@ -35,13 +35,11 @@ Classifier: Intended Audience :: Developers
|
|
35
35
|
Classifier: Topic :: Software Development :: Build Tools
|
36
36
|
Classifier: License :: OSI Approved :: MIT License
|
37
37
|
Classifier: Programming Language :: Python :: 3
|
38
|
-
Classifier: Programming Language :: Python :: 3.8
|
39
|
-
Classifier: Programming Language :: Python :: 3.9
|
40
38
|
Classifier: Programming Language :: Python :: 3.10
|
41
39
|
Classifier: Programming Language :: Python :: 3.11
|
42
40
|
Classifier: Programming Language :: Python :: 3.12
|
43
41
|
Classifier: Programming Language :: Python :: 3 :: Only
|
44
|
-
Requires-Python: >=3.
|
42
|
+
Requires-Python: >=3.9
|
45
43
|
Description-Content-Type: text/markdown
|
46
44
|
License-File: LICENSE.txt
|
47
45
|
Requires-Dist: peppercorn
|
@@ -4,10 +4,10 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "usso"
|
7
|
-
version = "0.20.
|
7
|
+
version = "0.20.6"
|
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
|
-
requires-python = ">=3.
|
10
|
+
requires-python = ">=3.9"
|
11
11
|
license = {file = "LICENSE.txt"}
|
12
12
|
keywords = ["usso", "sso", "authentication", "security", "fastapi", "django"]
|
13
13
|
authors = [
|
@@ -22,8 +22,6 @@ classifiers = [
|
|
22
22
|
"Topic :: Software Development :: Build Tools",
|
23
23
|
"License :: OSI Approved :: MIT License",
|
24
24
|
"Programming Language :: Python :: 3",
|
25
|
-
"Programming Language :: Python :: 3.8",
|
26
|
-
"Programming Language :: Python :: 3.9",
|
27
25
|
"Programming Language :: Python :: 3.10",
|
28
26
|
"Programming Language :: Python :: 3.11",
|
29
27
|
"Programming Language :: Python :: 3.12",
|
@@ -73,22 +73,28 @@ class UssoAPI(metaclass=Singleton):
|
|
73
73
|
)
|
74
74
|
if kwargs.get("raise_exception", True):
|
75
75
|
try:
|
76
|
+
resp_json = resp.json()
|
76
77
|
resp.raise_for_status()
|
77
78
|
except requests.HTTPError as e:
|
78
79
|
logging.error(f"Error: {e}")
|
79
|
-
logging.error(f"Response: {
|
80
|
+
logging.error(f"Response: {resp_json}")
|
81
|
+
raise e
|
82
|
+
except Exception as e:
|
83
|
+
logging.error(f"Error: {e}")
|
84
|
+
logging.error(f"Response: {resp.text}")
|
80
85
|
raise e
|
81
86
|
return resp.json()
|
82
87
|
|
83
88
|
def get_users(self, **kwargs) -> list[UserData]:
|
84
89
|
users_dict = self._request(endpoint="website/users", **kwargs)
|
85
90
|
|
86
|
-
return [
|
87
|
-
UserData(user_id=user.get("uid"), **user) for user in users_dict
|
88
|
-
]
|
91
|
+
return [UserData(user_id=user.get("uid"), **user) for user in users_dict]
|
89
92
|
|
90
93
|
def get_user(self, user_id: str, **kwargs) -> UserData:
|
91
|
-
user_dict = self._request(
|
94
|
+
user_dict = self._request(
|
95
|
+
endpoint=f"website/users/{user_id}",
|
96
|
+
**kwargs,
|
97
|
+
)
|
92
98
|
return UserData(user_id=user_dict.get("uid"), **user_dict)
|
93
99
|
|
94
100
|
def get_user_by_credentials(self, credentials: dict, **kwargs) -> UserData:
|
@@ -138,9 +144,7 @@ class UssoAPI(metaclass=Singleton):
|
|
138
144
|
return UserData(user_id=user_dict.get("uid"), **user_dict)
|
139
145
|
|
140
146
|
def get_user_payload(self, user_id: str, **kwargs) -> dict:
|
141
|
-
return self._request(
|
142
|
-
endpoint=f"website/users/{user_id}/payload", **kwargs
|
143
|
-
)
|
147
|
+
return self._request(endpoint=f"website/users/{user_id}/payload", **kwargs)
|
144
148
|
|
145
149
|
def update_user_payload(
|
146
150
|
self,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: usso
|
3
|
-
Version: 0.20.
|
3
|
+
Version: 0.20.6
|
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>
|
@@ -35,13 +35,11 @@ Classifier: Intended Audience :: Developers
|
|
35
35
|
Classifier: Topic :: Software Development :: Build Tools
|
36
36
|
Classifier: License :: OSI Approved :: MIT License
|
37
37
|
Classifier: Programming Language :: Python :: 3
|
38
|
-
Classifier: Programming Language :: Python :: 3.8
|
39
|
-
Classifier: Programming Language :: Python :: 3.9
|
40
38
|
Classifier: Programming Language :: Python :: 3.10
|
41
39
|
Classifier: Programming Language :: Python :: 3.11
|
42
40
|
Classifier: Programming Language :: Python :: 3.12
|
43
41
|
Classifier: Programming Language :: Python :: 3 :: Only
|
44
|
-
Requires-Python: >=3.
|
42
|
+
Requires-Python: >=3.9
|
45
43
|
Description-Content-Type: text/markdown
|
46
44
|
License-File: LICENSE.txt
|
47
45
|
Requires-Dist: peppercorn
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import unittest
|
2
2
|
import uuid
|
3
3
|
|
4
|
-
from usso.core import
|
4
|
+
from usso.core import Usso
|
5
5
|
from usso.exceptions import USSOException
|
6
6
|
|
7
7
|
|
@@ -29,7 +29,7 @@ class TestCore(unittest.TestCase):
|
|
29
29
|
valid_token = generate_valid_token()
|
30
30
|
|
31
31
|
# Call the user_data_from_token function with the valid token
|
32
|
-
user_data = user_data_from_token(valid_token)
|
32
|
+
user_data = Usso().user_data_from_token(valid_token)
|
33
33
|
|
34
34
|
# Assert that the user_data is not None
|
35
35
|
self.assertIsNotNone(user_data)
|
@@ -47,14 +47,14 @@ class TestCore(unittest.TestCase):
|
|
47
47
|
expired_token = generate_expired_token()
|
48
48
|
|
49
49
|
# Call the user_data_from_token function with the expired token
|
50
|
-
user_data = user_data_from_token(expired_token)
|
50
|
+
user_data = Usso().user_data_from_token(expired_token)
|
51
51
|
|
52
52
|
# Assert that the user_data is None
|
53
53
|
self.assertIsNone(user_data)
|
54
54
|
|
55
55
|
# Assert that the USSOException is raised with the expected error
|
56
56
|
with self.assertRaises(USSOException) as context:
|
57
|
-
user_data_from_token(expired_token, raise_exception=True)
|
57
|
+
Usso().user_data_from_token(expired_token, raise_exception=True)
|
58
58
|
self.assertEqual(context.exception.error, "expired_signature")
|
59
59
|
|
60
60
|
def test_user_data_from_token_invalid_token(self):
|
@@ -64,14 +64,14 @@ class TestCore(unittest.TestCase):
|
|
64
64
|
invalid_token = generate_invalid_token()
|
65
65
|
|
66
66
|
# Call the user_data_from_token function with the invalid token
|
67
|
-
user_data = user_data_from_token(invalid_token)
|
67
|
+
user_data = Usso().user_data_from_token(invalid_token)
|
68
68
|
|
69
69
|
# Assert that the user_data is None
|
70
70
|
self.assertIsNone(user_data)
|
71
71
|
|
72
72
|
# Assert that the USSOException is raised with the expected error
|
73
73
|
with self.assertRaises(USSOException) as context:
|
74
|
-
user_data_from_token(invalid_token, raise_exception=True)
|
74
|
+
Usso().user_data_from_token(invalid_token, raise_exception=True)
|
75
75
|
self.assertEqual(context.exception.error, "invalid_signature")
|
76
76
|
|
77
77
|
# Add more test cases for other scenarios
|
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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|