feat: support server-side sessions (#25795)

This commit is contained in:
Daniel Vaz Gaspar
2023-10-31 16:05:18 +00:00
committed by Michael S. Molina
parent cc5235829e
commit bd4c1a7445
6 changed files with 63 additions and 12 deletions

View File

@@ -27,6 +27,7 @@ from flask import Flask, redirect
from flask_appbuilder import expose, IndexView
from flask_babel import gettext as __, lazy_gettext as _
from flask_compress import Compress
from flask_session import Session
from werkzeug.middleware.proxy_fix import ProxyFix
from superset.constants import CHANGE_ME_SECRET_KEY
@@ -474,6 +475,10 @@ class SupersetAppInitializer: # pylint: disable=too-many-public-methods
logger.error("Refusing to start due to insecure SECRET_KEY")
sys.exit(1)
def configure_session(self) -> None:
if self.config["SESSION_SERVER_SIDE"]:
Session(self.superset_app)
def init_app(self) -> None:
"""
Main entry point which will delegate to other methods in
@@ -481,6 +486,7 @@ class SupersetAppInitializer: # pylint: disable=too-many-public-methods
"""
self.pre_init()
self.check_secret_key()
self.configure_session()
# Configuration of logging must be done first to apply the formatter properly
self.configure_logging()
# Configuration of feature_flags must be done first to allow init features