xn-auth 0.2.9__tar.gz → 0.2.11.dev1__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,13 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xn-auth
3
- Version: 0.2.9
3
+ Version: 0.2.11.dev1
4
4
  Summary: Auth adapter for XN-Api framework
5
5
  Author-email: Artemiev <mixartemev@gmail.com>
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://github.com/XyncNet/x-auth
8
8
  Project-URL: Repository, https://github.com/XyncNet/x-auth
9
9
  Keywords: starlette,fastapi,auth
10
- Requires-Python: >=3.12
10
+ Requires-Python: >=3.11
11
11
  Description-Content-Type: text/markdown
12
12
  Requires-Dist: fastapi
13
13
  Requires-Dist: pwdlib[argon2]
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "xn-auth"
3
- requires-python = ">=3.12"
3
+ requires-python = ">=3.11"
4
4
  authors = [
5
5
  {name = "Artemiev", email = "mixartemev@gmail.com"},
6
6
  ]
@@ -28,7 +28,10 @@ class AuthException(HTTPException, AuthenticationError):
28
28
  cookie_name_: str | None = cookie_name,
29
29
  ) -> None:
30
30
  hdrs = (
31
- {"set-cookie": cookie_name_ + "=; Path=/; Secure; SameSite=None; Expires=Thu, 01 Jan 1970 00:00:00 GMT"}
31
+ {
32
+ "set-cookie": cookie_name_
33
+ + "=; Domain=.xync.net; Path=/; Secure; SameSite=None; Expires=Thu, 01 Jan 1970 00:00:00 GMT"
34
+ }
32
35
  if cookie_name_
33
36
  else None
34
37
  )
@@ -70,7 +73,7 @@ def on_error(_: HTTPConnection, exc: AuthException) -> Response:
70
73
  if status_ == 303 and "/login" in (r.path for r in _.app.routes):
71
74
  hdr = {"Location": "/login"}
72
75
  resp = Response(exc.__repr__(), status_code=status_, headers=hdr)
73
- resp.delete_cookie(cookie_name, "/", secure=True, samesite="none")
76
+ resp.delete_cookie(cookie_name, "/", ".xync.net", secure=True, samesite="none")
74
77
  return resp
75
78
 
76
79
 
@@ -14,7 +14,7 @@ class AuthRefreshMiddleware:
14
14
 
15
15
  async def send_wrapper(msg: Message) -> None:
16
16
  if msg["type"] == "http.response.start" and (tok := scope.get("tok")):
17
- ck = f"access_token={tok}; Path=/; Secure; SameSite=None"
17
+ ck = f"access_token={tok}; Domain=.xync.net; Path=/; SameSite=none; Secure"
18
18
  msg["headers"].append((b"set-cookie", ck.encode()))
19
19
  user: AuthUser = scope["user"]
20
20
  logging.info(f"{user.display_name}:{user.id} updated token")
@@ -42,7 +42,7 @@ class AuthRouter:
42
42
  token = tokmod(access_token=jwt_encode(user, self.secret, self.expires), user=user)
43
43
  token_dict = token.model_dump()
44
44
  resp = JSONResponse(token_dict)
45
- resp.set_cookie("access_token", token.access_token, path="/", secure=True, samesite="none")
45
+ resp.set_cookie("access_token", token.access_token, path="/", domain=".xync.net", secure=True, samesite="none")
46
46
  return resp
47
47
 
48
48
  # api reg endpoint
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xn-auth
3
- Version: 0.2.9
3
+ Version: 0.2.11.dev1
4
4
  Summary: Auth adapter for XN-Api framework
5
5
  Author-email: Artemiev <mixartemev@gmail.com>
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://github.com/XyncNet/x-auth
8
8
  Project-URL: Repository, https://github.com/XyncNet/x-auth
9
9
  Keywords: starlette,fastapi,auth
10
- Requires-Python: >=3.12
10
+ Requires-Python: >=3.11
11
11
  Description-Content-Type: text/markdown
12
12
  Requires-Dist: fastapi
13
13
  Requires-Dist: pwdlib[argon2]
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