Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading of dataset fails if domain contains geoserver #259

Open
t-book opened this issue Mar 22, 2023 · 2 comments
Open

Loading of dataset fails if domain contains geoserver #259

t-book opened this issue Mar 22, 2023 · 2 comments
Labels
type: enhancement New feature or request

Comments

@t-book
Copy link

t-book commented Mar 22, 2023

Hi.

in case the domain includes geoserver like https://geoserver.example.org and a User is using basic auth
the loading fails with:

2023-03-22 01 37 26 PM

Unable to load layer RC_Samshvilde_2022_09_14_I_PL_9_Ortho_0_001_COG: Datenanbieter ist ungültig (Anbieter wms, URI: crs=EPSG:4326&url=https://geoserver.example.org/gs.example.org/geoserver/ows&format=image/png&layers=geonode:RC_Samshvilde_2022_09_14_I_PL_9_Ortho_0_001_COG&styles=&version=auto&authcfg=h9fd8v1

@giohappy @ricardogsilva
I would suggest this change to make the code more independent:

diff --git a/src/qgis_geonode/apiclient/geonode_v3.py b/src/qgis_geonode/apiclient/geonode_v3.py
index 0acc7b7..f889d8a 100644
--- a/src/qgis_geonode/apiclient/geonode_v3.py
+++ b/src/qgis_geonode/apiclient/geonode_v3.py
@@ -358,8 +358,8 @@ class GeonodeApiClientVersion_3_4_0(GeonodeApiClientVersion_3_x):
         if auth_provider_name == "basic":
             for service_type, retrieved_url in result.items():
                 try:
-                    prefix, suffix = retrieved_url.partition("geoserver")[::2]
-                    result[service_type] = f"{self.base_url}/gs{suffix}"
+                    prefix, suffix = retrieved_url.partition("/geoserver/")[::2]
+                    result[service_type] = f"{self.base_url}/gs/{suffix}"
                     log(f"result[service_type]: {self.base_url}/gs{suffix}")
                 except AttributeError:
                     pass

what do you think?

Best,

Toni

@t-book t-book changed the title Wrong endpoints with Basic auth enabled (configuration issue?) Loading of dataset fails if domain contains geoserver Mar 23, 2023
@giohappy
Copy link
Contributor

Nice catch @t-book.

Actually we should configure Geoserver for GeoNode with Basic auth backed by authentication service. It's been implemented but it wasn't ported as a standard configuration.

By the way, yes, for the moment your fix should work.

@giohappy giohappy added the type: enhancement New feature or request label Mar 23, 2023
@t-book
Copy link
Author

t-book commented Mar 23, 2023

Ok, great @giohappy thanks for your quick reply.
I will prepare a PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants