From bcahill at alertacademy.com Mon Jul 6 13:01:33 2026 From: bcahill at alertacademy.com (Benjamin Cahill) Date: Mon, 6 Jul 2026 15:01:33 -0500 Subject: [qgis-qwc2] Redirect to login page for unauthenticated users In-Reply-To: References: <7bd8524e-cfc6-4dfc-919a-f1009d4edc34@gmail.com> Message-ID: Hello, I found the following messages in my Drafts folder from last year. I'm not sure if it is the whole story, but if nothing else, it may be helpful information to someone else. We are using QField more than QWC2 at this point, but QWC2 does seem to be working better than it was as far as the login aspect. ======== I figured out how to redirect users that are not logged in to the login page. In the file qwc-services/config-in/default/config.json, set the Authentication plugin's requireLogin parameter to true as follows: { "name":"Authentication", "cfg":{ "requireLogin":true } }, Note that this needs to be done twice in the file?once in the mobile section and once in the desktop section. This looks like it is working as intended now and redirecting logged-out users to the login page. - Benjamin On Mon, May 5, 2025 at 10:39?AM Benjamin Cahill wrote: > > Sandro, > > Yes, this is at the top of the generated file > config/default/mapViewerConfig.json : > > { > "$schema": "https://github.com/qwc-services/qwc-map-viewer/raw/2024-lts/schemas/qwc-map-viewer.json", > "service": "map-viewer", > "config": { > "qwc2_path": "/qwc2/", > "auth_service_url": "/ldap/", > "data_service_url": "/api/v1/data/", > "#document_service_url": "/api/v1/document/", > "elevation_service_url": "/elevation/", > "info_service_url": "/api/v1/featureinfo/", > "legend_service_url": "/api/v1/legend/", > "mapinfo_service_url": "/api/v1/mapinfo/", > "ogc_service_url": "/ows/", > "permalink_service_url": "/api/v1/permalink/", > "#print_service_url": "/api/v1/print/", > "search_service_url": "/api/v2/search/", > "search_data_service_url": "/api/v2/search/geom/", > "auth_required": true > > - Benjamin > > On Sat, May 3, 2025 at 9:13?AM Sandro Mani wrote: > > > > Hello > > > > Do you see auth_required: true in the generated mapViewerConfig.json? > > > > Sandro > > > > On 01.05.25 17:48, Benjamin Cahill via qgis-qwc2 wrote: > > > Hello, > > > > > > Is there a way to redirect users that are not logged in to the login page? > > > > > > I found the "auth_required" option documented on the following page: > > > https://qwc-services.github.io/master/references/qwc-map-viewer/ > > > > > > But even after adding it to tenantConfig.json and re-generating the > > > config, it still does not redirect a new unauthenticated user (fresh > > > incognito window) to the login page. > > > > > > "name": "mapViewer", > > > "generator_config": { > > > "qwc2_config": { > > > "qwc2_config_file": "/srv/qwc_service/config-in/default/config.json", > > > "qwc2_index_file": "/srv/qwc_service/config-in/default/index.html" > > > } > > > }, > > > "config": { > > > "qwc2_path": "/qwc2/", > > > "auth_service_url": "/ldap/", > > > "data_service_url": "/api/v1/data/", > > > "#document_service_url": "/api/v1/document/", > > > "elevation_service_url": "/elevation/", > > > "info_service_url": "/api/v1/featureinfo/", > > > "legend_service_url": "/api/v1/legend/", > > > "mapinfo_service_url": "/api/v1/mapinfo/", > > > "ogc_service_url": "/ows/", > > > "permalink_service_url": "/api/v1/permalink/", > > > "#print_service_url": "/api/v1/print/", > > > "search_service_url": "/api/v2/search/", > > > "search_data_service_url": "/api/v2/search/geom/", > > > "auth_required": true > > > > > > I did try forcing a redirect from my webserver config by checking for > > > an access_token_cookie cookie, but that introduced other problems. > > > > > > Does anyone know how to get the auth_required option to redirect > > > unauthenticated users to the login page? > > > > > > Thank you, > > > > > > - Benjamin > > > _______________________________________________ > > > qgis-qwc2 mailing list > > > qgis-qwc2 at lists.osgeo.org > > > https://lists.osgeo.org/mailman/listinfo/qgis-qwc2