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-11352] REST service for URL checks #7582

Merged
merged 16 commits into from
May 27, 2024
Merged

Conversation

axl8713
Copy link
Contributor

@axl8713 axl8713 commented Apr 26, 2024

GEOS-11352 Powered by Pull Request Badge

Adding a REST service to manage URL checks would be potentially beneficial to those users who want to use automated tools to set URL rules for external access in their GeoServer instances.

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).

Copy link
Member

@aaime aaime left a comment

Choose a reason for hiding this comment

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

The general infrastructure looks ok, but there is a fundamental API breakage in this PR that needs to be reverted.

doc/en/api/1.0.0/urlchecks.yaml Show resolved Hide resolved
doc/en/user/source/rest/urlchecks.rst Outdated Show resolved Hide resolved
Comment on lines +265 to +280
<execution>
<id>generate-urlchecks-api</id>
<goals>
<goal>generate</goal>
</goals>
<configuration>
<generatorName>java</generatorName>
<inputSpec>${openapi-base-folder}/urlchecks.yaml</inputSpec>
<configurationFile>${project.basedir}/client-api-config.json</configurationFile>
<generateSupportingFiles>false</generateSupportingFiles>
<generateModelTests>false</generateModelTests>
<generateApiTests>false</generateApiTests>
<generateApiDocumentation>false</generateApiDocumentation>
<generateModelDocumentation>false</generateModelDocumentation>
</configuration>
</execution>
Copy link
Member

Choose a reason for hiding this comment

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

@groldan you're the maintainer of the rest-openapi module. Does this change look legit to you?

@axl8713 axl8713 requested a review from aaime May 10, 2024 16:01
Copy link
Member

@aaime aaime left a comment

Choose a reason for hiding this comment

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

Looks good, thanks.

@aaime aaime merged commit 67a654e into geoserver:main May 27, 2024
11 checks passed
@aaime
Copy link
Member

aaime commented May 27, 2024

Does this need to be backported? Normally we'd wait a month to perform backport of new functionality, but this is pretty much self contained, and should not cause any issue. But you'll need to ask about it on geoserver-devel.

@aaime
Copy link
Member

aaime commented May 30, 2024

The backport to 2.25.x failed:

The process '/usr/bin/git' failed with exit code 128
stderr
error: commit 64e644567d3a17f5987960d027484d172897f6c3 is a merge but no -m option was given.
fatal: cherry-pick failed

stdout
[backport-7582-to-2.25.x 49c670b428] [GEOS-11352] Added REST controller to handle URL checks.
 Author: Alessandro Ricchiuti <alessandro.ricchiuti@geosolutionsgroup.com>
 Date: Fri Apr 5 17:55:20 2024 +0200
 8 files changed, 262 insertions(+), 13 deletions(-)
 create mode 100644 src/restconfig/src/main/java/org/geoserver/rest/catalog/UrlCheckController.java
 create mode 100644 src/restconfig/src/main/java/org/geoserver/rest/catalog/ftl-templates/urlchecks.ftl
[backport-7582-to-2.25.x 1315bab1a7] [GEOS-11352] Moved UrlCheckController in the right package.
 Author: Alessandro Ricchiuti <alessandro.ricchiuti@geosolutionsgroup.com>
 Date: Mon Apr 8 17:41:13 2024 +0200
 1 file changed, 2 insertions(+), 2 deletions(-)
 rename src/restconfig/src/main/java/org/geoserver/rest/{catalog => security}/UrlCheckController.java (99%)
[backport-7582-to-2.25.x ffc452ea71] [GEOS-11352] Revised templates for URL check HTML rendering.
 Author: Alessandro Ricchiuti <alessandro.ricchiuti@geosolutionsgroup.com>
 Date: Mon Apr 8 17:42:12 2024 +0200
 6 files changed, 38 insertions(+), 35 deletions(-)
 delete mode 100644 src/restconfig/src/main/java/org/geoserver/rest/catalog/ftl-templates/urlchecks.ftl
 create mode 100644 src/restconfig/src/main/java/org/geoserver/rest/security/ftl-templates/AbstractUrlCheck.ftl
 create mode 100644 src/restconfig/src/main/java/org/geoserver/rest/security/ftl-templates/head.ftl
 create mode 100644 src/restconfig/src/main/java/org/geoserver/rest/security/ftl-templates/tail.ftl
 create mode 100644 src/restconfig/src/main/java/org/geoserver/rest/security/ftl-templates/urlchecks.ftl
[backport-7582-to-2.25.x 72f2224a83] [GEOS-11352] Added test for UrlCheckController.
 Author: Alessandro Ricchiuti <alessandro.ricchiuti@geosolutionsgroup.com>
 Date: Mon Apr 8 17:42:47 2024 +0200
 2 files changed, 383 insertions(+), 6 deletions(-)
 create mode 100644 src/restconfig/src/test/java/org/geoserver/rest/security/UrlCheckControllerTest.java
[backport-7582-to-2.25.x 2bf5d29ae4] [GEOS-11352] Cosmetic fixes.
 Author: Alessandro Ricchiuti <alessandro.ricchiuti@geosolutionsgroup.com>
 Date: Fri Apr 12 17:15:58 2024 +0200
 2 files changed, 5 insertions(+), 8 deletions(-)
Auto-merging doc/en/pom.xml
Auto-merging src/community/rest-openapi/generated/feign-client/pom.xml
[backport-7582-to-2.25.x 2718025ed2] [GEOS-11352] Added documentation for the URL check REST endpoints.
 Author: Alessandro Ricchiuti <alessandro.ricchiuti@geosolutionsgroup.com>
 Date: Fri Apr 12 11:57:00 2024 +0200
 8 files changed, 736 insertions(+), 1 deletion(-)
 create mode 100644 doc/en/api/1.0.0/urlchecks.yaml
 create mode 100644 doc/en/user/source/rest/api/urlchecks.rst
 create mode 100644 doc/en/user/source/rest/urlchecks.rst
 create mode 100644 src/community/rest-openapi/openapi/src/main/resources/org/geoserver/rest/openapi/1.0.0/urlchecks.yaml

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.25.x 2.25.x
# Navigate to the new working tree
cd .worktrees/backport-2.25.x
# Create a new branch
git switch --create backport-7582-to-2.25.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick 642a8a0691c88b2134700167e5c902ce77d57b45,447b9ae038e16305e991547c7787e970e3cce5bb,0834a1d558b5922faf0b6f286fe62e799231e224,817e1d8d14280db5d7389bcfdd6518b4008e4701,94c5de70c2d296ff90e08fc7f18f40793ae18458,aa0fbb2af3e69be25487ba7ca57c2e9628e8fb3d,64e644567d3a17f5987960d027484d172897f6c3,67bed79220912be08e2a5c606cc8a9cb2b63bab4,23413d4e29d37b3025d44134202b6da6ef0bf89e,b2a46746893ac107e1adf89f6249e590f1733e27,4621a71a99d695c9f3a1339c7c1381ac917504ce,48acf4b11593f151a5bbe0125c8d7671ae9d40ca,ab2ef8ac929881ade741acafcbf7c5c7e63dd90c,bc87d1d3ef1b4b08d0ab380ae893e06d478b1626,fd6b583d1d6d5199f39e4a85cccc39225e087cc7,32869eac17f20f5672fa7acc152ff793c6867dfd
# Push it to GitHub
git push --set-upstream origin backport-7582-to-2.25.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.25.x

Then, create a pull request where the base branch is 2.25.x and the compare/head branch is backport-7582-to-2.25.x.

axl8713 added a commit to axl8713/geoserver that referenced this pull request Jun 10, 2024
* [GEOS-11352] Added REST controller to handle URL checks.

* [GEOS-11352] Moved UrlCheckController in the right package.

* [GEOS-11352] Revised templates for URL check HTML rendering.

* [GEOS-11352] Added test for UrlCheckController.

* [GEOS-11352] Cosmetic fixes.

* [GEOS-11352] Added documentation for the URL check REST endpoints.

* [GEOS-11352] Removed unnecessary change.

* [GEOS-11352] Refactored HTTP POST response headers composition.

* [GEOS-11352] Reverted changes to url check enabled status field type.

* [GEOS-11352] Removed stray todo.

* [GEOS-11352] Revised url check controller.

* [GEOS-11352] Revised tests.

* [GEOS-11352] Updated documentation.

* [GEOS-11352] Updated rest-openapi documentation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants