-
Notifications
You must be signed in to change notification settings - Fork 279
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
[GWC-1363] Support Environment Parametrization for WMSLayer Credentials #1364
Merged
aaime
merged 1 commit into
GeoWebCache:main
from
groldan:wmslayer_http_credentials_env_variables
Feb 24, 2025
Merged
[GWC-1363] Support Environment Parametrization for WMSLayer Credentials #1364
aaime
merged 1 commit into
GeoWebCache:main
from
groldan:wmslayer_http_credentials_env_variables
Feb 24, 2025
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
d28c710
to
8871694
Compare
pmauduit
approved these changes
Feb 10, 2025
geowebcache/core/src/main/java/org/geowebcache/layer/wms/WMSHttpHelper.java
Show resolved
Hide resolved
geowebcache/core/src/main/java/org/geowebcache/layer/wms/WMSHttpHelper.java
Show resolved
Hide resolved
8871694
to
e3c9c90
Compare
jodygarnett
requested changes
Feb 17, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did not get a chance to try locally, minor feedback on version dependency management use
aaime
reviewed
Feb 17, 2025
geowebcache/core/src/main/java/org/geowebcache/GeoWebCacheEnvironment.java
Show resolved
Hide resolved
This commit enhances security and configurability by enabling dynamic runtime resolution of HTTP Basic Authentication credentials for WMS layers. Credentials can now be injected from environment variables, reducing the need to hardcode sensitive values. This improves code maintainability, supports secure multi- environment deployments, and simplifies testing through dynamic configuration. 1. **Dynamic Environment Parametrization**: - Introduced `GeoWebCacheEnvironment#isAllowEnvParametrization()` to replace the static `ALLOW_ENV_PARAMETRIZATION` field, allowing runtime toggling. 2. **Environment Variable Resolution Refactor**: - Replaced direct static field checks with method calls. - Updated `resolveValue()` and related methods to use environment variables dynamically. 3. **WMS Credentials Management Update**: - Added `getResolvedHttpUsername()` and `getResolvedHttpPassword()` in `WMSHttpHelper`. - Created `setGeoWebCacheEnvironment()` for dependency injection. 4. **Testing Enhancements**: - Integrated the `system-rules` library for environment variable manipulation. - Added tests to cover default, custom, and parameterized credentials. 5. **Code Improvements**: - Replaced unsafe casts in `resolveValue()`. - Improved exception handling by switching from `Throwable` to `RuntimeException`. - Added better logging and documentation for credential handling.
e3c9c90
to
6634b03
Compare
Looks good, merging |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit enhances security and configurability by enabling dynamic runtime resolution of HTTP Basic Authentication credentials for WMS layers. Credentials can now be injected from environment variables, reducing the need to hardcode sensitive values. This improves code maintainability, supports secure multi- environment deployments, and simplifies testing through dynamic configuration.
Dynamic Environment Parametrization:
GeoWebCacheEnvironment#isAllowEnvParametrization()
to replace the staticALLOW_ENV_PARAMETRIZATION
field, allowing runtime toggling.Environment Variable Resolution Refactor:
resolveValue()
and related methods to use environment variables dynamically.WMS Credentials Management Update:
getResolvedHttpUsername()
andgetResolvedHttpPassword()
inWMSHttpHelper
.setGeoWebCacheEnvironment()
for dependency injection.Testing Enhancements:
system-rules
library for environment variable manipulation.Code Improvements:
resolveValue()
.Throwable
toRuntimeException
.Fixes #1363