Skip to content

Commit 7d3d980

Browse files
committed
Allow reading auth_service_url from service config
1 parent 3f719ac commit 7d3d980

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

schemas/qwc-ogc-service.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
"type": "string"
4040
}
4141
},
42+
"auth_service_url": {
43+
"description": "URL to auth service, used for login redirects. Default: `/auth/`",
44+
"type": "string"
45+
},
4246
"network_timeout": {
4347
"description": "Network timeout for requests forwarded to the QGIS Server, in seconds. Default: `30`",
4448
"type": "number"

src/server.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@
1313
from ogcapi_service import OGCAPIService
1414

1515

16-
# Autologin config
17-
AUTH_PATH = os.environ.get(
18-
'AUTH_SERVICE_URL',
19-
# For backward compatiblity
20-
os.environ.get('AUTH_PATH', '/auth/'))
21-
2216
# Flask application
2317
app = Flask(__name__)
2418

@@ -83,7 +77,11 @@ def get_identity_or_auth(ogc_service):
8377

8478

8579
def auth_path_prefix():
86-
return app.session_interface.tenant_path_prefix().rstrip("/") + "/" + AUTH_PATH.lstrip("/")
80+
tenant = tenant_handler.tenant()
81+
config_handler = RuntimeConfig("ogc", app.logger)
82+
config = config_handler.tenant_config(tenant)
83+
auth_path = config.get('auth_service_url', '/auth/')
84+
return app.session_interface.tenant_path_prefix().rstrip("/") + "/" + auth_path.lstrip("/")
8785

8886

8987
@app.before_request

0 commit comments

Comments
 (0)