usso 0.16.0__py3-none-any.whl → 0.18.0__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/__init__.py +2 -0
- usso/api.py +9 -3
- usso/core.py +3 -2
- usso/fastapi/__init__.py +2 -0
- usso/fastapi/integration.py +6 -2
- {usso-0.16.0.dist-info → usso-0.18.0.dist-info}/METADATA +1 -1
- usso-0.18.0.dist-info/RECORD +14 -0
- usso-0.16.0.dist-info/RECORD +0 -14
- {usso-0.16.0.dist-info → usso-0.18.0.dist-info}/LICENSE.txt +0 -0
- {usso-0.16.0.dist-info → usso-0.18.0.dist-info}/WHEEL +0 -0
- {usso-0.16.0.dist-info → usso-0.18.0.dist-info}/entry_points.txt +0 -0
- {usso-0.16.0.dist-info → usso-0.18.0.dist-info}/top_level.txt +0 -0
usso/__init__.py
CHANGED
usso/api.py
CHANGED
@@ -65,10 +65,14 @@ class UssoAPI(metaclass=Singleton):
|
|
65
65
|
return self._request(endpoint=f"website/users/{user_id}/credentials/")
|
66
66
|
|
67
67
|
def get_user_by_credentials(self, credentials: dict):
|
68
|
-
return self._request(
|
68
|
+
return self._request(
|
69
|
+
endpoint="website/users/credentials/", data=credentials
|
70
|
+
)
|
69
71
|
|
70
72
|
def create_user(self, user_data: dict):
|
71
|
-
return self._request(
|
73
|
+
return self._request(
|
74
|
+
method="post", endpoint="website/users/", data=user_data
|
75
|
+
)
|
72
76
|
|
73
77
|
def create_user_credentials(self, user_id: str, credentials: dict):
|
74
78
|
return self._request(
|
@@ -82,7 +86,9 @@ class UssoAPI(metaclass=Singleton):
|
|
82
86
|
):
|
83
87
|
if credentials:
|
84
88
|
user_data["authenticators"] = [credentials]
|
85
|
-
return self._request(
|
89
|
+
return self._request(
|
90
|
+
method="post", endpoint="website/users/", data=user_data
|
91
|
+
)
|
86
92
|
|
87
93
|
def get_user_payload(self, user_id: str):
|
88
94
|
return self._request(endpoint=f"website/users/{user_id}/payload/")
|
usso/core.py
CHANGED
@@ -41,7 +41,7 @@ class UserData(BaseModel):
|
|
41
41
|
|
42
42
|
|
43
43
|
class Usso(metaclass=Singleton):
|
44
|
-
def __init__(self, jwks_url: str|None = None):
|
44
|
+
def __init__(self, jwks_url: str | None = None):
|
45
45
|
if jwks_url is None:
|
46
46
|
jwks_url = os.getenv("USSO_JWKS_URL")
|
47
47
|
self.jwks_url = jwks_url
|
@@ -50,7 +50,8 @@ class Usso(metaclass=Singleton):
|
|
50
50
|
def get_jwks_keys(self):
|
51
51
|
return jwt.PyJWKClient(self.jwks_url)
|
52
52
|
|
53
|
-
def get_authorization_scheme_param(
|
53
|
+
def get_authorization_scheme_param(
|
54
|
+
self,
|
54
55
|
authorization_header_value: Optional[str],
|
55
56
|
) -> Tuple[str, str]:
|
56
57
|
if not authorization_header_value:
|
usso/fastapi/__init__.py
CHANGED
usso/fastapi/integration.py
CHANGED
@@ -14,7 +14,9 @@ async def jwt_access_security(request: Request) -> UserData | None:
|
|
14
14
|
kwargs = {}
|
15
15
|
authorization = request.headers.get("Authorization")
|
16
16
|
if authorization:
|
17
|
-
scheme, _, credentials = Usso().get_authorization_scheme_param(
|
17
|
+
scheme, _, credentials = Usso().get_authorization_scheme_param(
|
18
|
+
authorization
|
19
|
+
)
|
18
20
|
if scheme.lower() == "bearer":
|
19
21
|
token = credentials
|
20
22
|
return Usso().user_data_from_token(token, **kwargs)
|
@@ -36,7 +38,9 @@ async def jwt_access_security_ws(websocket: WebSocket) -> UserData | None:
|
|
36
38
|
kwargs = {}
|
37
39
|
authorization = websocket.headers.get("Authorization")
|
38
40
|
if authorization:
|
39
|
-
scheme, _, credentials = Usso().get_authorization_scheme_param(
|
41
|
+
scheme, _, credentials = Usso().get_authorization_scheme_param(
|
42
|
+
authorization
|
43
|
+
)
|
40
44
|
if scheme.lower() == "bearer":
|
41
45
|
token = credentials
|
42
46
|
return Usso().user_data_from_token(token, **kwargs)
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: usso
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.18.0
|
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>
|
@@ -0,0 +1,14 @@
|
|
1
|
+
usso/__init__.py,sha256=r-fyIVLnUT6r5pNnQaRzHZYhQ2b6DoJD0D-ZgoO91ik,97
|
2
|
+
usso/api.py,sha256=Sxo1JJOzfjSuidmFWfdE4g2CrllLxxWjzrW9VXSpKP4,3329
|
3
|
+
usso/b64tools.py,sha256=6YCBx2lLaYFdk36f064VNZ1RejJTHtmgxqq0eT1sCwQ,518
|
4
|
+
usso/core.py,sha256=3K6LMsryvqf3b7NZwNUt7Hx31xJ9KX3g7Pa6HBjkY4o,3034
|
5
|
+
usso/exceptions.py,sha256=hawOAuVbvQtjgRfwp1KFZ4SmV7fh720y5Gom9JVA8W8,504
|
6
|
+
usso/package_data.dat,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
+
usso/fastapi/__init__.py,sha256=TRTDVJo8bwZQDAuCQFhh-g1XbIspf6TdFYXGAO5cgAU,130
|
8
|
+
usso/fastapi/integration.py,sha256=9Q10dfy8UagOkmG49-Ar0mj6PPsiKS8ioLFgBIREpWQ,1823
|
9
|
+
usso-0.18.0.dist-info/LICENSE.txt,sha256=ceC9ZJOV9H6CtQDcYmHOS46NA3dHJ_WD4J9blH513pc,1081
|
10
|
+
usso-0.18.0.dist-info/METADATA,sha256=XpDPq1YPrmX5aCClDCnUP3yS1m2MbQ5es3KC5M0935Q,4334
|
11
|
+
usso-0.18.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
12
|
+
usso-0.18.0.dist-info/entry_points.txt,sha256=4Zgpm5ELaAWPf0jPGJFz1_X69H7un8ycT3WdGoJ0Vvk,35
|
13
|
+
usso-0.18.0.dist-info/top_level.txt,sha256=g9Jf6h1Oyidh0vPiFni7UHInTJjSvu6cUalpLTIvthg,5
|
14
|
+
usso-0.18.0.dist-info/RECORD,,
|
usso-0.16.0.dist-info/RECORD
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
usso/__init__.py,sha256=fluJnb9X2ECUnUA0lNNR2xHdn3uSI2RVErQiFlqbOiU,49
|
2
|
-
usso/api.py,sha256=RL13XwcnmbH4LVbjojwiwp8L9eioL_GKOkCyLaU0b7w,3263
|
3
|
-
usso/b64tools.py,sha256=6YCBx2lLaYFdk36f064VNZ1RejJTHtmgxqq0eT1sCwQ,518
|
4
|
-
usso/core.py,sha256=tkwvnDmDnB6SS8QqSv_eC1I_wwR7ld5BXeahldAa5EA,3023
|
5
|
-
usso/exceptions.py,sha256=hawOAuVbvQtjgRfwp1KFZ4SmV7fh720y5Gom9JVA8W8,504
|
6
|
-
usso/package_data.dat,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
-
usso/fastapi/__init__.py,sha256=WqTIF9BNKlq5f0H8Vk-fcQawPWZMclwuD8QwO4agW7I,69
|
8
|
-
usso/fastapi/integration.py,sha256=rkR9uZbe-DEBMgHYtIaP3QUhL6hWHM6edFhBDJQWuz0,1779
|
9
|
-
usso-0.16.0.dist-info/LICENSE.txt,sha256=ceC9ZJOV9H6CtQDcYmHOS46NA3dHJ_WD4J9blH513pc,1081
|
10
|
-
usso-0.16.0.dist-info/METADATA,sha256=zKyEYZR741xiYumQ5VCZTJQiKCv8b7cBmoSmpgnaVpo,4334
|
11
|
-
usso-0.16.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
12
|
-
usso-0.16.0.dist-info/entry_points.txt,sha256=4Zgpm5ELaAWPf0jPGJFz1_X69H7un8ycT3WdGoJ0Vvk,35
|
13
|
-
usso-0.16.0.dist-info/top_level.txt,sha256=g9Jf6h1Oyidh0vPiFni7UHInTJjSvu6cUalpLTIvthg,5
|
14
|
-
usso-0.16.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|