I'm creating a micro service in Spring Boot which needs to communicate with an existing authentication service.
I have setup the OAuth configuration in Spring Boot, but I'm seeing the following error when it tries to talk to the external authentication service.
Could not fetch user details: class org.springframework.web.client.ResourceAccessException, I/O error on GET request for "https://somedomain.com/profile": sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target; nested exception is javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
This appears to be because the certificate on the remote authentication service isn't valid, so it doesn't like it.
How do I resolve this?
I have tried to use openssl to download the domains certificate, and I've added this to Java's keystore, but that didn't fix the problem.
To grab and install the cert I did the following;
openssl s_client -showcerts -connect somedomain.com:443
keytool -importcert -keystore /Library/Java/JavaVirtualMachines/jdk1.8.0_171.jdk/Contents/Home/jre/lib/security/cacerts -storepass changeit -file /Users/myuser/Downloads/plplpl.crt
I was asked if I wanted to trust the cert, I selected yes.