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

[GEOS-11369] Additional authentication options for cascaded WMS|WMTS data stores #7552

Merged
merged 8 commits into from Apr 30, 2024

Conversation

petersmythe
Copy link
Contributor

@petersmythe petersmythe commented Apr 17, 2024

GEOS-11369 Powered by Pull Request Badge

Unlike cascaded WMTS stores, WMS stores do not have the option to pass an HTTP header along with the request (for authentication purposes):

image

This PR, in conjunction with GeoTools PR, fixes that.

I am also considering another field for a querystring API key/authkey, for both WMS and WMTS stores.

Related

This PR is to be merged concurrently with:

Checklist

For core and extension modules:

  • New unit tests have been added covering the changes.
  • Documentation has been updated (if change is visible to end users).
  • The REST API docs have been updated (when changing configuration objects or the REST controllers).
  • There is an issue in the GeoServer Jira (except for changes that do not affect administrators or end users in any way).
  • Commit message(s) must be in the form [GEOS-XYZWV] Title of the Jira ticket.
  • Bug fixes and small new features are presented as a single commit.
  • Each commit has a single objective (if there are multiple commits, each has a separate JIRA ticket describing its goal).

@petersmythe
Copy link
Contributor Author

Tests are failing because it relies on GeoTools PR to be committed first

@petersmythe petersmythe requested review from jodygarnett and removed request for jodygarnett April 17, 2024 11:07
@petersmythe

This comment was marked as resolved.

@petersmythe petersmythe changed the title Add HTTP Headers to cascaded WMS store [GEOS-11369] Additional authentication options for cascaded WMS|WMTS data stores Apr 18, 2024
@petersmythe petersmythe marked this pull request as ready for review April 18, 2024 19:59
@petersmythe petersmythe requested a review from aaime April 20, 2024 12:29
@petersmythe
Copy link
Contributor Author

Tests are failing because it relies on GeoTools PR to be committed first

image

Copy link
Member

@jodygarnett jodygarnett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR looks good thank you for the improvement :)

I have a question about a single header name / value pair being supported; it seems inconsistent with code comments.

petersmythe pushed a commit to petersmythe/geotools that referenced this pull request Apr 25, 2024
petersmythe added a commit to geotools/geotools that referenced this pull request Apr 30, 2024
…Server) to append additional querystring parameters e.g. AuthKey to every request made by the HTTPClient (#4727)

* To support HTTP Headers see github.com/geoserver/geoserver/pull/7552

* Add AuthKey by appending to URL in HTTPClient

* Undo test version in pom files

* Fix SimpleHTTPClient

* Add test cases

* Fix review issues with URL

* URL Host not Authority

* Change AuthKey -> ExtraParams and from String to Map

* URL encode keys and values and build a test that verifies this

* Update modules/extension/wms/src/main/java/org/geotools/ows/wms/WebMapServer.java

Improve grammar

Co-authored-by: Jody Garnett <jody.garnett@gmail.com>

* Update modules/library/http/src/main/java/org/geotools/http/HTTPClient.java

Improve docs

Co-authored-by: Jody Garnett <jody.garnett@gmail.com>

* Petersmythe map string object (#2)

Replace Map<String, Object>

* Change null to emptyMap, add duplicate key check

* Oops, when applying patch

* Fix integer test

* Fix spelling

* To support HTTP Headers see github.com/geoserver/geoserver/pull/7552

* Add AuthKey by appending to URL in HTTPClient

* Undo test version in pom files

* Fix SimpleHTTPClient

* Add test cases

* Fix review issues with URL

* URL Host not Authority

* Change AuthKey -> ExtraParams and from String to Map

* URL encode keys and values and build a test that verifies this

* Update modules/extension/wms/src/main/java/org/geotools/ows/wms/WebMapServer.java

Improve grammar

Co-authored-by: Jody Garnett <jody.garnett@gmail.com>

* Update modules/library/http/src/main/java/org/geotools/http/HTTPClient.java

Improve docs

Co-authored-by: Jody Garnett <jody.garnett@gmail.com>

* Petersmythe map string object (#2)

Replace Map<String, Object>

* Change null to emptyMap, add duplicate key check

* Oops, when applying patch

* Fix integer test

* Fix spelling

---------

Co-authored-by: Peter Smythe <peter@afrigis.co.za>
Co-authored-by: Jody Garnett <jody.garnett@gmail.com>
@petersmythe
Copy link
Contributor Author

Merging with geotools/geotools#4727

@petersmythe petersmythe reopened this Apr 30, 2024
@aaime
Copy link
Member

aaime commented Apr 30, 2024

Merging, the lack of coordination between geotools and GeoServer is breaking several builds and workflows (two people already mentioned it to me). When you do coordinates PRs, please make sure to merge them toghether.

@aaime aaime merged commit d215cb8 into geoserver:main Apr 30, 2024
5 of 23 checks passed
@sikeoka
Copy link
Contributor

sikeoka commented Apr 30, 2024

FYI, this PR is failing the QA build:

15:47:21,974 [INFO] --- pmd:3.14.0:check (default) @ gs-main ---
15:47:21,977 [INFO] PMD version: 6.42.0
15:47:21,978 [INFO] PMD Failure: org.geoserver.catalog.WMSStoreInfo:40 Rule:MissingOverride Priority:3 The method 'getAuthKey()' is missing an @Override annotation..
15:47:21,978 [INFO] PMD Failure: org.geoserver.catalog.WMSStoreInfo:42 Rule:MissingOverride Priority:3 The method 'setAuthKey(String)' is missing an @Override annotation..
15:47:21,978 [INFO] PMD Failure: org.geoserver.catalog.WMTSStoreInfo:40 Rule:MissingOverride Priority:3 The method 'getAuthKey()' is missing an @Override annotation..
15:47:21,978 [INFO] PMD Failure: org.geoserver.catalog.WMTSStoreInfo:42 Rule:MissingOverride Priority:3 The method 'setAuthKey(String)' is missing an @Override annotation..
15:47:21,978 [INFO] PMD Failure: org.geoserver.catalog.WMSStoreInfo:40 Rule:MissingOverride Priority:3 The method 'getAuthKey()' is missing an @Override annotation..
15:47:21,978 [INFO] PMD Failure: org.geoserver.catalog.WMSStoreInfo:42 Rule:MissingOverride Priority:3 The method 'setAuthKey(String)' is missing an @Override annotation..
15:47:21,978 [INFO] PMD Failure: org.geoserver.catalog.WMTSStoreInfo:40 Rule:MissingOverride Priority:3 The method 'getAuthKey()' is missing an @Override annotation..
15:47:21,978 [INFO] PMD Failure: org.geoserver.catalog.WMTSStoreInfo:42 Rule:MissingOverride Priority:3 The method 'setAuthKey(String)' is missing an @Override annotation..

@petersmythe
Copy link
Contributor Author

Yes @sikeoka , I am also noticing that the GeoServer build is failing, which is why I delayed merging GeoServer @aaime , I will investigate now

@petersmythe petersmythe mentioned this pull request Apr 30, 2024
11 tasks
@petersmythe
Copy link
Contributor Author

Fixed now with #7589

petersmythe added a commit to geotools/geotools that referenced this pull request May 2, 2024
…Server) to append additional querystring parameters e.g. AuthKey to every request made by the HTTPClient (#4727)

* To support HTTP Headers see github.com/geoserver/geoserver/pull/7552

* Add AuthKey by appending to URL in HTTPClient

* Undo test version in pom files

* Fix SimpleHTTPClient

* Add test cases

* Fix review issues with URL

* URL Host not Authority

* Change AuthKey -> ExtraParams and from String to Map

* URL encode keys and values and build a test that verifies this

* Update modules/extension/wms/src/main/java/org/geotools/ows/wms/WebMapServer.java

Improve grammar

Co-authored-by: Jody Garnett <jody.garnett@gmail.com>

* Update modules/library/http/src/main/java/org/geotools/http/HTTPClient.java

Improve docs

Co-authored-by: Jody Garnett <jody.garnett@gmail.com>

* Petersmythe map string object (#2)

Replace Map<String, Object>

* Change null to emptyMap, add duplicate key check

* Oops, when applying patch

* Fix integer test

* Fix spelling

* To support HTTP Headers see github.com/geoserver/geoserver/pull/7552

* Add AuthKey by appending to URL in HTTPClient

* Undo test version in pom files

* Fix SimpleHTTPClient

* Add test cases

* Fix review issues with URL

* URL Host not Authority

* Change AuthKey -> ExtraParams and from String to Map

* URL encode keys and values and build a test that verifies this

* Update modules/extension/wms/src/main/java/org/geotools/ows/wms/WebMapServer.java

Improve grammar

Co-authored-by: Jody Garnett <jody.garnett@gmail.com>

* Update modules/library/http/src/main/java/org/geotools/http/HTTPClient.java

Improve docs

Co-authored-by: Jody Garnett <jody.garnett@gmail.com>

* Petersmythe map string object (#2)

Replace Map<String, Object>

* Change null to emptyMap, add duplicate key check

* Oops, when applying patch

* Fix integer test

* Fix spelling

---------

Co-authored-by: Peter Smythe <peter@afrigis.co.za>
Co-authored-by: Jody Garnett <jody.garnett@gmail.com>
petersmythe added a commit to geotools/geotools that referenced this pull request May 2, 2024
…Server) to append additional querystring parameters e.g. AuthKey to every request made by the HTTPClient (#4727) (#4735)

* To support HTTP Headers see github.com/geoserver/geoserver/pull/7552

* Add AuthKey by appending to URL in HTTPClient

* Undo test version in pom files

* Fix SimpleHTTPClient

* Add test cases

* Fix review issues with URL

* URL Host not Authority

* Change AuthKey -> ExtraParams and from String to Map

* URL encode keys and values and build a test that verifies this

* Update modules/extension/wms/src/main/java/org/geotools/ows/wms/WebMapServer.java

Improve grammar



* Update modules/library/http/src/main/java/org/geotools/http/HTTPClient.java

Improve docs



* Petersmythe map string object (#2)

Replace Map<String, Object>

* Change null to emptyMap, add duplicate key check

* Oops, when applying patch

* Fix integer test

* Fix spelling

* To support HTTP Headers see github.com/geoserver/geoserver/pull/7552

* Add AuthKey by appending to URL in HTTPClient

* Undo test version in pom files

* Fix SimpleHTTPClient

* Add test cases

* Fix review issues with URL

* URL Host not Authority

* Change AuthKey -> ExtraParams and from String to Map

* URL encode keys and values and build a test that verifies this

* Update modules/extension/wms/src/main/java/org/geotools/ows/wms/WebMapServer.java

Improve grammar



* Update modules/library/http/src/main/java/org/geotools/http/HTTPClient.java

Improve docs



* Petersmythe map string object (#2)

Replace Map<String, Object>

* Change null to emptyMap, add duplicate key check

* Oops, when applying patch

* Fix integer test

* Fix spelling

---------

Co-authored-by: Peter Smythe <peter@afrigis.co.za>
Co-authored-by: Jody Garnett <jody.garnett@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants