fix: all mappings should use getValidProxyModeValue (#24756)

closes #24630

Signed-off-by: Steve Hawkins <shawkins@redhat.com>
This commit is contained in:
Steven Hawkins 2023-11-15 08:31:44 -05:00 committed by GitHub
parent b6d5083e9b
commit 07a3def4a2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -25,17 +25,17 @@ final class ProxyPropertyMappers {
fromOption(ProxyOptions.PROXY_FORWARDED_HOST)
.to("quarkus.http.proxy.enable-forwarded-host")
.mapFrom("proxy")
.transformer(ProxyPropertyMappers::getResolveEnableForwardedHost)
.transformer(ProxyPropertyMappers::getValidProxyModeValue)
.build(),
fromOption(ProxyOptions.PROXY_FORWARDED_HEADER_ENABLED)
.to("quarkus.http.proxy.allow-forwarded")
.mapFrom("proxy")
.transformer(ProxyPropertyMappers::getResolveEnableForwardedHost)
.transformer(ProxyPropertyMappers::getValidProxyModeValue)
.build(),
fromOption(ProxyOptions.PROXY_X_FORWARDED_HEADER_ENABLED)
.to("quarkus.http.proxy.allow-x-forwarded")
.mapFrom("proxy")
.transformer(ProxyPropertyMappers::getResolveEnableForwardedHost)
.transformer(ProxyPropertyMappers::getValidProxyModeValue)
.build()
};
}
@ -56,8 +56,4 @@ final class ProxyPropertyMappers {
}
}
private static Optional<String> getResolveEnableForwardedHost(Optional<String> proxy, ConfigSourceInterceptorContext context) {
return of(String.valueOf(!ProxyOptions.Mode.none.name().equals(proxy)));
}
}