cloudfoundry / java-buildpack

Cloud Foundry buildpack for running Java applications
Apache License 2.0
433 stars 2.59k forks source link

Add client certificate mapper ability to choose version #1043

Closed anthonydahanne closed 7 months ago

anthonydahanne commented 8 months ago

Fix for https://github.com/cloudfoundry/java-buildpack/issues/1039

anthonydahanne commented 8 months ago

Eventually, we took another direction thanks to @nebhale guidance: using the same client-certificate-mapper jar for all 4 use cases:

The "magic" that allows such a feat relies on providing a way for each 4 cases to register the servlet filter that will transform the request coming from another CF service into a client certificate equipped request.

I also manually tested it with:

[...]
   -----> Downloading Client Certificate Mapper 2.0.0 from https://anthonydahanne.github.io/java-buildpack-client-certificate-mapper/client-certificate-mapper-2.0.0.jar (0.1s)
   -----> Downloading Container Security Provider 1.20.0_RELEASE from https://java-buildpack.cloudfoundry.org/container-security-provider/container-security-provider-1.20.0-RELEASE.jar (0.2s)
   -----> Downloading Java Cf Env 3.1.2 from https://java-buildpack.cloudfoundry.org/java-cfenv/java-cfenv-3.1.2.jar (0.1s)
   Exit status 0
[...]
cf ssh sb3-no-cfenv 
 find ./ -iname "*certif*.*"
./app/.java-buildpack/client_certificate_mapper/client_certificate_mapper-2.0.0.jar
./app/org/springframework/boot/loader/jar/JarEntryCertification.class
./app/BOOT-INF/lib/client_certificate_mapper-2.0.0.jar
anthonydahanne commented 8 months ago

No need for this new option, see previous comment

New usecase: user forces the v1.x version with:

JBP_CONFIG_CLIENT_CERTIFICATE_MAPPER: '{javax_forced: true}'
   -----> Downloading Client Certificate Mapper 1.11.0_RELEASE from https://java-buildpack.cloudfoundry.org/client-certificate-mapper/client-certificate-mapper-1.11.0-RELEASE.jar (0.1s)
   -----> Downloading Container Security Provider 1.20.0_RELEASE from https://java-buildpack.cloudfoundry.org/container-security-provider/container-security-provider-1.20.0-RELEASE.jar (0.1s)
   -----> Downloading Java Cf Env 3.1.2 from https://java-buildpack.cloudfoundry.org/java-cfenv/java-cfenv-3.1.2.jar (0.1s)
   Exit status 0