Springboot RestClient (не webclient, не Resttemplate) с InsecureTrustmanagerFactory.Inship с sslbundleJAVA

Программисты JAVA общаются здесь
Anonymous
Springboot RestClient (не webclient, не Resttemplate) с InsecureTrustmanagerFactory.Inship с sslbundle

Сообщение Anonymous »

Есть сторонняя конечная точка отдыха, с которой я пытаюсь взаимодействовать. Этот сторонний API требует аутентификации сертификата. Для этого я использую следующее, используя Spring Sslbundle: < /p>

Код: Выделить всё

@Bean
public RestClient restClient(RestClient.Builder builder, RestClientSsl ssl) {
return builder.baseUrl("https://the-secure-api.com/api")
.defaultHeader(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON_VALUE, HttpHeaders.ACCEPT, MediaType.APPLICATION_JSON_VALUE)
.apply(ssl.fromBundle("mybundle"))
.build();
}
< /code>
spring:
ssl:
bundle:
jks:
mybundle:
keystore:
location: C:\\ssl\\keystore.p12
password: 123
type: PKCS12
truststore:
location: C:\\ssl\\truststore.p12
password: 123
type: PKCS12
reload-on-update: true
< /code>
This is working fine. The third-party app confirms they can see my client certificate being sent to them. I am also validating their certificate with my trust store. I would like to disable SSL validation on my side. I tried to remove this from the property, leaving .apply(ssl.fromBundle("mybundle"))

Код: Выделить всё

spring:
ssl:
bundle:
jks:
mybundle:
keystore:
location: C:\\ssl\\keystore.p12
password: 123
type: PKCS12
reload-on-update: true

< /code>
And thought this would equal to InsecureTrustManagerFactory.INSTANCE 
, которого нет.>

Подробнее здесь: https://stackoverflow.com/questions/797 ... rustmanage

Вернуться в «JAVA»