I have integration tests in my spring boot application and some tests need to get a token from Keycloak. Every communication is via SSL with a self-signed certificate.
When launching those tests I got that exception :
SunCertPathBuilderException: unable to find valid certification path to requested target
The problem seem similar to Accept server's self-signed ssl certificate in Java client but this solution doesn't work for me.
This is where I get the token :
private AccessTokenResponse getToken() throws GeneralSecurityException {
Keycloak keycloak = Keycloak.getInstance(keycloakAuthServerUrl, keycloakRealm,
login, password, keycloakResource, keycloakCredentialsSecret);
return keycloak.tokenManager().getAccessToken();
}