usso 0.15.0__tar.gz → 0.17.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: usso
3
- Version: 0.15.0
3
+ Version: 0.17.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>
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "usso"
7
- version = "0.15.0"
7
+ version = "0.17.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"
@@ -1 +1,3 @@
1
1
  from .core import UserData, user_data_from_token
2
+
3
+ __all__ = ["UserData", "user_data_from_token"]
@@ -35,7 +35,7 @@ class UssoAPI(metaclass=Singleton):
35
35
  if not self.access_token:
36
36
  return False
37
37
 
38
- user_data = USSO(
38
+ user_data = Usso(
39
39
  jwks_url=f"{self.url}/website/jwks.json?"
40
40
  ).user_data_from_token(self.access_token)
41
41
  if user_data:
@@ -41,7 +41,9 @@ class UserData(BaseModel):
41
41
 
42
42
 
43
43
  class Usso(metaclass=Singleton):
44
- def __init__(self, jwks_url: str):
44
+ def __init__(self, jwks_url: str|None = None):
45
+ if jwks_url is None:
46
+ jwks_url = os.getenv("USSO_JWKS_URL")
45
47
  self.jwks_url = jwks_url
46
48
 
47
49
  @lru_cache
@@ -1 +1,3 @@
1
1
  from .integration import jwt_access_security, jwt_access_security_ws
2
+
3
+ __all__ = ["jwt_access_security", "jwt_access_security_ws"]
@@ -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(authorization)
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(authorization)
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.15.0
3
+ Version: 0.17.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>
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes