I have a service that exposes an API which I'd like to test. I'm running the service on localhost and it has a self-signed certificate.
I added the .p12 file to test/resources and on @BeforeAll
:
RestAssured
.config()
.sslConfig(
new SSLConfig().with().trustStoreType("PKCS12").and().relaxedHTTPSValidation().and()
.trustStore(ResourceUtils.getFile("classpath:cert.p12"), "mypassword"));
Also added this:
RestAssured.config().sslConfig(SSLConfig.sslConfig().allowAllHostnames());
Although, I'm getting the following error:
javax.net.ssl.SSLPeerUnverifiedException: peer not authenticated
Why?
UPDATE:
On runtime I can see that RestAssured.config().getSSLConfig().getTrustStore()
is null
but how?
UPDATE 2: I don't mind that REST assured will trust all certificates (security isn't an issue)