Closed stephenc closed 1 year ago
This would be nice to get merged as it would help solve: https://github.com/jenkinsci/hashicorp-vault-plugin/issues/101
Anyone interested?
Seems nobody is interested. If someone decides this is of value, feel free to use this PR as a basis or not as you see fit
Unclear if this is wanted, but here is my suggestion of a zero-dep idiomatic proxy support addition to your API.
Notes/Rationale:
Use of things like proxy properties is kind of bad. People who need to use a proxy to access Vault may not want the proxy configuration globally set for the JDK.
Similarly, the current API behaviour of implicitly relying on the
ProxySelector.getDefault()
throughURL.openConnection()
is rather evil as this means that the only way to control the proxy requires race conditions with other JDK code, nevermind that in some cases the JRE permissions may have blockedsetProxySelector
from the application.The JRE's
Proxy
class does not encapsulate proxy authentication but is otherwise sufficiently generic that it should be ok.With regards to proxy authentication, this can be a tricky problem, for example if Kerberos authentication is configured on the proxy. For this reason I am suggesting either to leave proxy authentication out (first commit on PR) or to just expose the ability to configure the
Proxy-Authenticate
header (second commit on PR)... a fancier solution would be to change theproxyAuth
field from aString
to aSupplier<String>
to enable per-request header generation... though anyone with that complex a need is probably better off just creating a newVault
instance for each request anyway!