usso 0.7.0__tar.gz → 0.9.0__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.7.0/src/usso.egg-info → usso-0.9.0}/PKG-INFO +4 -1
- {usso-0.7.0 → usso-0.9.0}/pyproject.toml +5 -2
- usso-0.9.0/src/usso/b64tools.py +19 -0
- {usso-0.7.0 → usso-0.9.0}/src/usso/core.py +14 -1
- {usso-0.7.0 → usso-0.9.0/src/usso.egg-info}/PKG-INFO +4 -1
- {usso-0.7.0 → usso-0.9.0}/src/usso.egg-info/SOURCES.txt +1 -0
- {usso-0.7.0 → usso-0.9.0}/src/usso.egg-info/requires.txt +3 -0
- {usso-0.7.0 → usso-0.9.0}/LICENSE.txt +0 -0
- {usso-0.7.0 → usso-0.9.0}/README.md +0 -0
- {usso-0.7.0 → usso-0.9.0}/setup.cfg +0 -0
- {usso-0.7.0 → usso-0.9.0}/src/usso/__init__.py +0 -0
- {usso-0.7.0 → usso-0.9.0}/src/usso/exceptions.py +0 -0
- {usso-0.7.0 → usso-0.9.0}/src/usso/fastapi/__init__.py +0 -0
- {usso-0.7.0 → usso-0.9.0}/src/usso/fastapi/integration.py +0 -0
- {usso-0.7.0 → usso-0.9.0}/src/usso/package_data.dat +0 -0
- {usso-0.7.0 → usso-0.9.0}/src/usso.egg-info/dependency_links.txt +0 -0
- {usso-0.7.0 → usso-0.9.0}/src/usso.egg-info/entry_points.txt +0 -0
- {usso-0.7.0 → usso-0.9.0}/src/usso.egg-info/top_level.txt +0 -0
- {usso-0.7.0 → usso-0.9.0}/tests/test_simple.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: usso
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.9.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>
|
@@ -45,6 +45,9 @@ Requires-Python: >=3.8
|
|
45
45
|
Description-Content-Type: text/markdown
|
46
46
|
License-File: LICENSE.txt
|
47
47
|
Requires-Dist: peppercorn
|
48
|
+
Requires-Dist: pydantic>=1.8.2
|
49
|
+
Requires-Dist: requests>=2.26.0
|
50
|
+
Requires-Dist: pyjwt[crypto]
|
48
51
|
Provides-Extra: fastapi
|
49
52
|
Requires-Dist: fastapi>=0.65.0; extra == "fastapi"
|
50
53
|
Requires-Dist: uvicorn[standard]>=0.13.0; extra == "fastapi"
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "usso"
|
7
|
-
version = "0.
|
7
|
+
version = "0.9.0"
|
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.8"
|
@@ -30,7 +30,10 @@ classifiers = [
|
|
30
30
|
"Programming Language :: Python :: 3 :: Only",
|
31
31
|
]
|
32
32
|
dependencies = [
|
33
|
-
"peppercorn" # Example main dependency
|
33
|
+
"peppercorn", # Example main dependency
|
34
|
+
"pydantic>=1.8.2",
|
35
|
+
"requests>=2.26.0",
|
36
|
+
"pyjwt[crypto]"
|
34
37
|
]
|
35
38
|
optional-dependencies = {"fastapi" = ["fastapi>=0.65.0", "uvicorn[standard]>=0.13.0"],"django" = ["Django>=3.2"],"dev" = ["check-manifest"],"test" = ["coverage"]}
|
36
39
|
|
@@ -0,0 +1,19 @@
|
|
1
|
+
import uuid
|
2
|
+
import base64
|
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
|
@@ -1,9 +1,11 @@
|
|
1
|
+
import uuid
|
2
|
+
import base64
|
1
3
|
from functools import lru_cache
|
2
4
|
from typing import Optional, Tuple
|
3
5
|
|
4
6
|
import jwt
|
5
7
|
from pydantic import BaseModel
|
6
|
-
|
8
|
+
from . import b64tools
|
7
9
|
|
8
10
|
class UserData(BaseModel):
|
9
11
|
user_id: str
|
@@ -15,6 +17,17 @@ class UserData(BaseModel):
|
|
15
17
|
data: dict | None = None
|
16
18
|
token: str | None = None
|
17
19
|
|
20
|
+
@property
|
21
|
+
def id(self) -> uuid.UUID:
|
22
|
+
user_id = self.user_id
|
23
|
+
|
24
|
+
if user_id.startswith("u_"):
|
25
|
+
user_id = user_id[2:]
|
26
|
+
if 22 <= len(user_id) <= 24:
|
27
|
+
user_id = b64tools.b64_decode_uuid(user_id)
|
28
|
+
|
29
|
+
return uuid.UUID(user_id)
|
30
|
+
|
18
31
|
|
19
32
|
def get_authorization_scheme_param(
|
20
33
|
authorization_header_value: Optional[str],
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: usso
|
3
|
-
Version: 0.
|
3
|
+
Version: 0.9.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>
|
@@ -45,6 +45,9 @@ Requires-Python: >=3.8
|
|
45
45
|
Description-Content-Type: text/markdown
|
46
46
|
License-File: LICENSE.txt
|
47
47
|
Requires-Dist: peppercorn
|
48
|
+
Requires-Dist: pydantic>=1.8.2
|
49
|
+
Requires-Dist: requests>=2.26.0
|
50
|
+
Requires-Dist: pyjwt[crypto]
|
48
51
|
Provides-Extra: fastapi
|
49
52
|
Requires-Dist: fastapi>=0.65.0; extra == "fastapi"
|
50
53
|
Requires-Dist: uvicorn[standard]>=0.13.0; extra == "fastapi"
|
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
|