mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
add util.add_samesite_fields(response, value)
This function adds f"SameSite={value}" to each cookie's header stored in response. This is needed because starlette does not currently support the `samesite` argument in Response.set_cookie. It is merged, however, and waiting for next release. Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
parent
ec632a7091
commit
91dc3efc75
6 changed files with 23 additions and 5 deletions
|
@ -14,6 +14,7 @@ from starlette.requests import Request
|
|||
import aurweb.config
|
||||
import aurweb.db
|
||||
|
||||
from aurweb import util
|
||||
from aurweb.l10n import get_translator_for_request
|
||||
from aurweb.schema import Bans, Sessions, Users
|
||||
|
||||
|
@ -140,7 +141,7 @@ async def authenticate(request: Request, redirect: str = None, conn=Depends(aurw
|
|||
response.set_cookie(key="SSO_ID_TOKEN", value=token["id_token"],
|
||||
path="/sso/", httponly=True,
|
||||
secure=secure_cookies)
|
||||
return response
|
||||
return util.add_samesite_fields(response, "strict")
|
||||
else:
|
||||
# We’ve got a severe integrity violation.
|
||||
raise Exception("Multiple accounts found for SSO account " + sub)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue