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

Added implementation of TLS-registry for GraphQL Client #41

Conversation

mskacelik
Copy link

No description provided.

@mskacelik mskacelik force-pushed the tls-registry-smallrye-graphql branch 5 times, most recently from 7b5ef19 to 69a70f5 Compare September 30, 2024 10:52
@mskacelik
Copy link
Author

//cc @jmartisk

@jmartisk
Copy link
Owner

@cescoffier could you give this a look, please? It's for my branch for now, because this branch captures all the stuff that we will apply together with the SmallRye GraphQL 2.11 update. The related smallrye-side changes are in smallrye/smallrye-graphql#2194

Copy link

@cescoffier cescoffier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I need to check the SmallRye branch, but this part looks good. I've added some minor comments.

Thanks!

import io.vertx.core.net.JksOptions;

public class SSLTestingTools {
static Vertx vertx = Vertx.vertx();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make sure you close the instance.

options.setHost("localhost");

if (keystorePath != null) {
JksOptions keystoreOptions = new JksOptions();

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you pass p12 better use the associated options.

Copy link

@cescoffier cescoffier Sep 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might be called pfx


private static final String CONFIGURATION = """
quarkus.smallrye-graphql-client.my-client.tls-configuration-name=my-tls-client
quarkus.tls.my-tls-client.key-store.p12.path=target/certs/wrong-graphql-client-keystore.p12

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know what is supported by the client? P12, JKS seems to be supported. What about pem?

Copy link
Author

@mskacelik mskacelik Sep 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I know, SRGQL by itself supports only P12 and JKS since it works with path, password, and type fields.
see:
https://github.com/smallrye/smallrye-graphql/blob/5ff2b59a0e16386ba03a51e47f908426667cd1c3/client/implementation/src/main/java/io/smallrye/graphql/client/impl/GraphQLClientConfiguration.java#L65-L78

However, this new integration should support all three types
Should I add separate tests for them (JKS/P12/PEM)?

But I talked with @jmartisk about possibly adding a feature to adding integration of PEM format in SRGQL (raw).

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should support just whatever the TLS registry extension passes to us, AFAIU the GraphQL client shouldn't need to care about the underlying format, no? As long as we receive a io.vertx.core.net.KeyCertOptions or TrustOptions. I don't think we need to test each format separately on the GraphQL client side.

As for the original (very crude) support for keystores and truststores, I wouldn't care too much about updating it with extra formats, we clearly mark is as deprecated.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, if it's Vertx based, no problem. It's for everything else :-)

graphQLClientConfiguration
.setTlsKeyStoreOptions(updatedTlsConfiguration.getKeyStoreOptions());
graphQLClientConfiguration
.setTlsTrustStoreOptions(updatedTlsConfiguration.getTrustStoreOptions());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We might need to reload a bit more, typically CRL. But it's already great!

@jmartisk jmartisk merged commit c1c5311 into jmartisk:smallrye-graphql-2.11 Oct 1, 2024
Copy link

github-actions bot commented Oct 1, 2024

🙈 The PR is closed and the preview is expired.

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

Successfully merging this pull request may close these issues.

3 participants