You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm learning spring cloud and I have a p12 self signed certificate for eureka and configserver in a p12 file in my classpath. The certificate load correctly overwritting the @bean as follow
Hello,
I'm learning spring cloud and I have a p12 self signed certificate for eureka and configserver in a p12 file in my classpath. The certificate load correctly overwritting the @bean as follow
@Bean public RestTemplateDiscoveryClientOptionalArgs getTrustStoredEurekaClient() throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException { RestTemplateDiscoveryClientOptionalArgs args = new RestTemplateDiscoveryClientOptionalArgs(requestFactory); args.setSSLContext(new SSLContextBuilder() .loadTrustMaterial(trustStore.getURL(), trustStorePassword.toCharArray()).build()); args.setHostnameVerifier(NoopHostnameVerifier.INSTANCE); return args; }
@Bean public ConfigServicePropertySourceLocator configServicePropertySourceLocator() throws KeyManagementException, NoSuchAlgorithmException, KeyStoreException, CertificateException, IOException { ConfigServicePropertySourceLocator configServicePropertySourceLocator = new ConfigServicePropertySourceLocator( configClientProperties); configServicePropertySourceLocator.setRestTemplate(createTemplate()); return configServicePropertySourceLocator; }
But using properties to load the p12 in the http client
spring.cloud.gateway.httpclient.ssl.trust-store=classpath:keystore/springboot.p12
spring.cloud.gateway.httpclient.ssl.trust-store-password=password
spring.cloud.gateway.httpclient.ssl.trust-store-type=pkcs12
don't load the certificate, return "PKIX path building failed:"
But using the pem file of the certificate
spring.cloud.gateway.httpclient.ssl.trusted-x509-certificates=${user.home}${file.separator}certificate.crt
Works correctly.
Please someone have had the same problem?
The text was updated successfully, but these errors were encountered: