usso 0.8.0__py3-none-any.whl → 0.10.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 +0 -1
- usso/b64tools.py +19 -0
- usso/core.py +14 -0
- usso/fastapi/__init__.py +0 -1
- {usso-0.8.0.dist-info → usso-0.10.0.dist-info}/METADATA +1 -1
- usso-0.10.0.dist-info/RECORD +13 -0
- usso-0.8.0.dist-info/RECORD +0 -12
- {usso-0.8.0.dist-info → usso-0.10.0.dist-info}/LICENSE.txt +0 -0
- {usso-0.8.0.dist-info → usso-0.10.0.dist-info}/WHEEL +0 -0
- {usso-0.8.0.dist-info → usso-0.10.0.dist-info}/entry_points.txt +0 -0
- {usso-0.8.0.dist-info → usso-0.10.0.dist-info}/top_level.txt +0 -0
usso/__init__.py
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
from .core import UserData
|
usso/b64tools.py
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
import base64
|
2
|
+
import uuid
|
3
|
+
|
4
|
+
|
5
|
+
def b64_encode_uuid(uuid_str):
|
6
|
+
uuid_bytes = uuid.UUID(uuid_str).bytes
|
7
|
+
encoded_uuid = base64.urlsafe_b64encode(uuid_bytes).decode()
|
8
|
+
return encoded_uuid
|
9
|
+
|
10
|
+
|
11
|
+
def b64_encode_uuid_strip(uuid_str):
|
12
|
+
return b64_encode_uuid(uuid_str).rstrip("=")
|
13
|
+
|
14
|
+
|
15
|
+
def b64_decode_uuid(encoded_uuid):
|
16
|
+
encoded_uuid += "=" * (4 - len(encoded_uuid) % 4) # Add padding if needed
|
17
|
+
decoded_uuid = base64.urlsafe_b64decode(encoded_uuid)
|
18
|
+
uuid_obj = uuid.UUID(bytes=decoded_uuid)
|
19
|
+
return uuid_obj
|
usso/core.py
CHANGED
@@ -1,9 +1,12 @@
|
|
1
|
+
import uuid
|
1
2
|
from functools import lru_cache
|
2
3
|
from typing import Optional, Tuple
|
3
4
|
|
4
5
|
import jwt
|
5
6
|
from pydantic import BaseModel
|
6
7
|
|
8
|
+
from . import b64tools
|
9
|
+
|
7
10
|
|
8
11
|
class UserData(BaseModel):
|
9
12
|
user_id: str
|
@@ -15,6 +18,17 @@ class UserData(BaseModel):
|
|
15
18
|
data: dict | None = None
|
16
19
|
token: str | None = None
|
17
20
|
|
21
|
+
@property
|
22
|
+
def uid(self) -> uuid.UUID:
|
23
|
+
user_id = self.user_id
|
24
|
+
|
25
|
+
if user_id.startswith("u_"):
|
26
|
+
user_id = user_id[2:]
|
27
|
+
if 22 <= len(user_id) <= 24:
|
28
|
+
user_id = b64tools.b64_decode_uuid(user_id)
|
29
|
+
|
30
|
+
return uuid.UUID(user_id)
|
31
|
+
|
18
32
|
|
19
33
|
def get_authorization_scheme_param(
|
20
34
|
authorization_header_value: Optional[str],
|
usso/fastapi/__init__.py
CHANGED
@@ -1 +0,0 @@
|
|
1
|
-
from .integration import user_data_from_token, jwt_access_security
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: usso
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.10.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,13 @@
|
|
1
|
+
usso/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
usso/b64tools.py,sha256=6YCBx2lLaYFdk36f064VNZ1RejJTHtmgxqq0eT1sCwQ,518
|
3
|
+
usso/core.py,sha256=ym9A9rwASFoRV7TQ_bKbnIST806bXbOnJXdIzRWdJQA,1009
|
4
|
+
usso/exceptions.py,sha256=hawOAuVbvQtjgRfwp1KFZ4SmV7fh720y5Gom9JVA8W8,504
|
5
|
+
usso/package_data.dat,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
6
|
+
usso/fastapi/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
+
usso/fastapi/integration.py,sha256=WGDSYGMRA-jguHzyQr96iGZEoV_pbP0OaCRt_Tm6mtg,2583
|
8
|
+
usso-0.10.0.dist-info/LICENSE.txt,sha256=ceC9ZJOV9H6CtQDcYmHOS46NA3dHJ_WD4J9blH513pc,1081
|
9
|
+
usso-0.10.0.dist-info/METADATA,sha256=uGSzelvISKfCq1MHyfgssn-C5hHMRx1bqVYCfxO8ZmQ,4306
|
10
|
+
usso-0.10.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
11
|
+
usso-0.10.0.dist-info/entry_points.txt,sha256=4Zgpm5ELaAWPf0jPGJFz1_X69H7un8ycT3WdGoJ0Vvk,35
|
12
|
+
usso-0.10.0.dist-info/top_level.txt,sha256=g9Jf6h1Oyidh0vPiFni7UHInTJjSvu6cUalpLTIvthg,5
|
13
|
+
usso-0.10.0.dist-info/RECORD,,
|
usso-0.8.0.dist-info/RECORD
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
usso/__init__.py,sha256=bHjlWFkwxHTNsC0g-aUqynQ8IrtXp1apELqCqsrynns,27
|
2
|
-
usso/core.py,sha256=h9dvXVW1ZQN-vp8W2nrqf5Msz9uTXIWJ5cxnWw1SZ_Q,695
|
3
|
-
usso/exceptions.py,sha256=hawOAuVbvQtjgRfwp1KFZ4SmV7fh720y5Gom9JVA8W8,504
|
4
|
-
usso/package_data.dat,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
5
|
-
usso/fastapi/__init__.py,sha256=mLF1jtu9w1WXksXh6F8RoOLnh3s5W9S22iPq6uF6zQU,66
|
6
|
-
usso/fastapi/integration.py,sha256=WGDSYGMRA-jguHzyQr96iGZEoV_pbP0OaCRt_Tm6mtg,2583
|
7
|
-
usso-0.8.0.dist-info/LICENSE.txt,sha256=ceC9ZJOV9H6CtQDcYmHOS46NA3dHJ_WD4J9blH513pc,1081
|
8
|
-
usso-0.8.0.dist-info/METADATA,sha256=lIRDYs4ltP6v89MCLDl8eBFs4bCbY5zxbS4D-RPvdw0,4305
|
9
|
-
usso-0.8.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
10
|
-
usso-0.8.0.dist-info/entry_points.txt,sha256=4Zgpm5ELaAWPf0jPGJFz1_X69H7un8ycT3WdGoJ0Vvk,35
|
11
|
-
usso-0.8.0.dist-info/top_level.txt,sha256=g9Jf6h1Oyidh0vPiFni7UHInTJjSvu6cUalpLTIvthg,5
|
12
|
-
usso-0.8.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|