Skip to content

Commit adbed4f

Browse files
committed
Read auth_service_url from service config when redirecting due to auth_required
1 parent 160afbd commit adbed4f

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

src/server.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,6 @@
1010
from qwc_services_core.runtime_config import RuntimeConfig
1111
from qwc2_viewer import QWC2Viewer
1212

13-
# Autologin config
14-
AUTH_PATH = os.environ.get(
15-
'AUTH_SERVICE_URL',
16-
# For backward compatiblity
17-
os.environ.get('AUTH_PATH', '/auth/'))
18-
1913
# Flask application
2014
app = Flask(__name__)
2115
# disable verbose 404 error message
@@ -52,7 +46,11 @@ def with_no_cache_headers(response):
5246

5347

5448
def auth_path_prefix():
55-
return app.session_interface.tenant_path_prefix().rstrip("/") + "/" + AUTH_PATH.lstrip("/")
49+
tenant = tenant_handler.tenant()
50+
config_handler = RuntimeConfig("mapViewer", app.logger)
51+
config = config_handler.tenant_config(tenant)
52+
auth_path = config.get('auth_service_url', '/auth/')
53+
return app.session_interface.tenant_path_prefix().rstrip("/") + "/" + auth_path.lstrip("/")
5654

5755

5856
@app.before_request

0 commit comments

Comments
 (0)