[qgis-qwc2] Redirect to login page for unauthenticated users

Benjamin Cahill bcahill at alertacademy.com
Mon May 5 08:39:27 PDT 2025


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 <manisandro at gmail.com> 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


More information about the qgis-qwc2 mailing list