Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Be able to send a keystore with relaxedHTTPSValidation #1631

Open
mathieu-amblard opened this issue Oct 4, 2022 · 1 comment
Open

Be able to send a keystore with relaxedHTTPSValidation #1631

mathieu-amblard opened this issue Oct 4, 2022 · 1 comment

Comments

@mathieu-amblard
Copy link
Contributor

I would like to implement Service Integration Tests using rest-assured.
The main idea is to execute some requests to validate that the service has been correctly deployed.
This service is behind an intranet proxy configured with HTTPS, therefore I would like to send a keystore and trust all certificates.

If I configured the SSL from like this :

given()
    .config(newConfig().sslConfig(
            new SSLConfig()
                    .keyStore(myKeystore, myKeystorePass)
                    .relaxedHTTPSValidation()
    ))
...

I get the following exception :

400 Bad Request : No required SSL certificate was sent

I was expected the keystore to be sent but as you can see it was not the case.

As a workaround, I have configured the SSL using the SSLSocketFactory :

...
KeyManagerFactory kmf =
        KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
kmf.init(myKeystore, myKeystorePass.toCharArray());
KeyManager[] kms = kmf.getKeyManagers();
...
SSLContext sslContext = SSLContext.getInstance();
sslContext.init(kms, null, null);
SSLSocketFactory factory = new SSLSocketFactory(sslContext,
        SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
...
given()
    .config(newConfig().sslConfig(
            new SSLConfig()
                    .sslSocketFactory(factory)
    ))

What is annoyed me with the workaround is that the SSLSocketFactory is deprecated (already addressed with #1610) and especially that the relaxedHTTPSValidation does almost the same (except the keystore configuration).

Would it be possible to have a .relaxedHTTPSValidation() method containing parameters for loading a keystore or that uses a keystore configured with the method keystore(...) ?

If you agree to add a such functionality, I can make you a proposal in a Pull Request if needed.

Thank you in advance

@mathieu-amblard
Copy link
Contributor Author

PR Created

johanhaleby pushed a commit that referenced this issue Oct 21, 2022
)

Co-authored-by: Mathieu AMBLARD (u118971) <mathieu.amblard@mobi.ch>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant