usso 0.25.1__tar.gz → 0.25.3__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.25.1/src/usso.egg-info → usso-0.25.3}/PKG-INFO +1 -2
- {usso-0.25.1 → usso-0.25.3}/pyproject.toml +2 -2
- {usso-0.25.1 → usso-0.25.3}/src/usso/core.py +11 -2
- {usso-0.25.1 → usso-0.25.3}/src/usso/fastapi/integration.py +2 -2
- {usso-0.25.1 → usso-0.25.3/src/usso.egg-info}/PKG-INFO +1 -2
- {usso-0.25.1 → usso-0.25.3}/src/usso.egg-info/requires.txt +0 -1
- {usso-0.25.1 → usso-0.25.3}/LICENSE.txt +0 -0
- {usso-0.25.1 → usso-0.25.3}/README.md +0 -0
- {usso-0.25.1 → usso-0.25.3}/setup.cfg +0 -0
- {usso-0.25.1 → usso-0.25.3}/src/usso/__init__.py +0 -0
- {usso-0.25.1 → usso-0.25.3}/src/usso/api.py +0 -0
- {usso-0.25.1 → usso-0.25.3}/src/usso/async_api.py +0 -0
- {usso-0.25.1 → usso-0.25.3}/src/usso/async_session.py +0 -0
- {usso-0.25.1 → usso-0.25.3}/src/usso/b64tools.py +0 -0
- {usso-0.25.1 → usso-0.25.3}/src/usso/django/__init__.py +0 -0
- {usso-0.25.1 → usso-0.25.3}/src/usso/django/middleware.py +0 -0
- {usso-0.25.1 → usso-0.25.3}/src/usso/exceptions.py +0 -0
- {usso-0.25.1 → usso-0.25.3}/src/usso/fastapi/__init__.py +0 -0
- {usso-0.25.1 → usso-0.25.3}/src/usso/session.py +0 -0
- {usso-0.25.1 → usso-0.25.3}/src/usso.egg-info/SOURCES.txt +0 -0
- {usso-0.25.1 → usso-0.25.3}/src/usso.egg-info/dependency_links.txt +0 -0
- {usso-0.25.1 → usso-0.25.3}/src/usso.egg-info/entry_points.txt +0 -0
- {usso-0.25.1 → usso-0.25.3}/src/usso.egg-info/top_level.txt +0 -0
- {usso-0.25.1 → usso-0.25.3}/tests/test_api.py +0 -0
- {usso-0.25.1 → usso-0.25.3}/tests/test_core.py +0 -0
- {usso-0.25.1 → usso-0.25.3}/tests/test_simple.py +0 -0
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: usso
|
3
|
-
Version: 0.25.
|
3
|
+
Version: 0.25.3
|
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,7 +45,6 @@ License-File: LICENSE.txt
|
|
45
45
|
Requires-Dist: pydantic>=2
|
46
46
|
Requires-Dist: requests>=2.26.0
|
47
47
|
Requires-Dist: pyjwt[crypto]
|
48
|
-
Requires-Dist: singleton_package
|
49
48
|
Requires-Dist: cachetools
|
50
49
|
Provides-Extra: fastapi
|
51
50
|
Requires-Dist: fastapi>=0.65.0; extra == "fastapi"
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
4
4
|
|
5
5
|
[project]
|
6
6
|
name = "usso"
|
7
|
-
version = "0.25.
|
7
|
+
version = "0.25.3"
|
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"
|
@@ -31,7 +31,7 @@ dependencies = [
|
|
31
31
|
"pydantic>=2",
|
32
32
|
"requests>=2.26.0",
|
33
33
|
"pyjwt[crypto]",
|
34
|
-
"singleton_package",
|
34
|
+
# "singleton_package",
|
35
35
|
"cachetools",
|
36
36
|
]
|
37
37
|
optional-dependencies = {"fastapi" = ["fastapi>=0.65.0", "uvicorn[standard]>=0.13.0"],"django" = ["Django>=3.2"],"dev" = ["check-manifest"],"test" = ["coverage"]}
|
@@ -7,7 +7,6 @@ from functools import lru_cache
|
|
7
7
|
import cachetools.func
|
8
8
|
import jwt
|
9
9
|
from pydantic import BaseModel, model_validator
|
10
|
-
from singleton import Singleton
|
11
10
|
|
12
11
|
from . import b64tools
|
13
12
|
from .exceptions import USSOException
|
@@ -61,6 +60,7 @@ def get_authorization_scheme_param(
|
|
61
60
|
def decode_token(key, token: str, algorithms=["RS256"], **kwargs) -> dict:
|
62
61
|
try:
|
63
62
|
decoded = jwt.decode(token, key, algorithms=algorithms)
|
63
|
+
decoded["data"] = decoded
|
64
64
|
decoded["token"] = token
|
65
65
|
return UserData(**decoded)
|
66
66
|
except jwt.exceptions.ExpiredSignatureError:
|
@@ -188,7 +188,16 @@ class Usso:
|
|
188
188
|
exp = None
|
189
189
|
for jwk_config in self.jwt_configs:
|
190
190
|
try:
|
191
|
-
|
191
|
+
user_data = jwk_config.decode(token)
|
192
|
+
if user_data.token_type.lower() != kwargs.get("token_type", "access"):
|
193
|
+
raise USSOException(
|
194
|
+
status_code=401,
|
195
|
+
error="invalid_token_type",
|
196
|
+
message="Token type must be 'access'",
|
197
|
+
)
|
198
|
+
|
199
|
+
return user_data
|
200
|
+
|
192
201
|
except USSOException as e:
|
193
202
|
exp = e
|
194
203
|
|
@@ -5,7 +5,7 @@ from starlette.status import HTTP_401_UNAUTHORIZED
|
|
5
5
|
|
6
6
|
from usso.exceptions import USSOException
|
7
7
|
|
8
|
-
from ..core import UserData, Usso
|
8
|
+
from ..core import UserData, Usso, get_authorization_scheme_param
|
9
9
|
|
10
10
|
logger = logging.getLogger("usso")
|
11
11
|
|
@@ -15,7 +15,7 @@ def get_request_token(request: Request | WebSocket) -> UserData | None:
|
|
15
15
|
token = None
|
16
16
|
|
17
17
|
if authorization:
|
18
|
-
scheme, credentials =
|
18
|
+
scheme, credentials = get_authorization_scheme_param(authorization)
|
19
19
|
if scheme.lower() == "bearer":
|
20
20
|
token = credentials
|
21
21
|
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: usso
|
3
|
-
Version: 0.25.
|
3
|
+
Version: 0.25.3
|
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,7 +45,6 @@ License-File: LICENSE.txt
|
|
45
45
|
Requires-Dist: pydantic>=2
|
46
46
|
Requires-Dist: requests>=2.26.0
|
47
47
|
Requires-Dist: pyjwt[crypto]
|
48
|
-
Requires-Dist: singleton_package
|
49
48
|
Requires-Dist: cachetools
|
50
49
|
Provides-Extra: fastapi
|
51
50
|
Requires-Dist: fastapi>=0.65.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
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|