My application is a Spring OAuth2 client using keycloak as the OAuth Security server. When I configure the application to use SSL, it fails to connect to the open-id configuration endpoint. I can successfully connect to the URL in a browser outside the app/IDE.
After some debugging I think it is because it is reading the default truststore from the IDE instead of the one configured in my application.yaml.
Any suggestions on what is causing it to ignore the values in application.yaml?
Thanks for taking time to read and think about my question!
The errors
Caused by: org.springframework.web.client.ResourceAccessException: I/O error on GET request for "https://localhost:8443/realms/MyRealm/.well-known/openid-configuration": PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Caused by: javax.net.ssl.SSLHandshakeException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Caused by: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
Caused by: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target
application.yaml
server:
port: 9443
ssl:
key-store-type: PKCS12
key-store-password: ${self.signed.password}
key-alias: tim-asus
key-store: classpath:keystore/self_signed.p12
enabled: true
My command line includes -Djavax.net.debug=all
Debug output
javax.net.ssl|DEBUG|22|restartedMain|2024-05-28 17:18:28.070 CDT|TrustStoreManager.java:113|trustStore is: C:Usersme.jdkstemurin-21.0.2libsecuritycacerts
trustStore type is: pkcs12