Skip to content

Commit

Permalink
Fix JWT_ACCESS_COOKIE_PATH with tenant (#11)
Browse files Browse the repository at this point in the history
* Set JWT_ACCESS_COOKIE_PATH regarding tenant before each request

* Set version to 1.3.26

* Only set JWT_ACCESS_COOKIE_PATH when app is multi-tenant
  • Loading branch information
benoitblanc authored Feb 14, 2024
1 parent 212af77 commit 3165ac9
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 10 additions & 0 deletions qwc_services_core/jwt.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ def handle_jwt_exceptions(resp):

return resp

@app.before_request
def set_jwt_access_cookie_path():
# If app.session_interface is a TenantSessionInterface, JWT_ACCESS_COOKIE_PATH is set regarding tenant
# Else it takes value from SESSION_COOKIE_PATH config var, or APPLICATION_ROOT or /
# https://flask.palletsprojects.com/en/3.0.x/api/#flask.sessions.SessionInterface.get_cookie_path
from .tenant_handler import TenantSessionInterface
if isinstance(app.session_interface, TenantSessionInterface):
if app.session_interface.is_multi():
app.session_interface.get_cookie_path(app)

if api:

@api.errorhandler
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

setuptools.setup(
name="qwc-services-core",
version="1.3.25",
version="1.3.26",
author="Sourcepole AG",
author_email="[email protected]",
description="Shared modules for QWC services",
Expand Down

0 comments on commit 3165ac9

Please sign in to comment.