-
Notifications
You must be signed in to change notification settings - Fork 184
Accept SSL certificates by providing a URL to use cert from within a jar #318
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
Conversation
Hey @Squiry. I would like to make sure that I got the issue right. The following properties sslCert, sslKey, sslRootCert (PostgresqlConnectionConfiguration.Builder) should be changed from string to java.net.URL. We should validate URL inside setters. Also, I tried to create an instance of a URL with Also, how can I create an instance of a URL with Btw I have checked Spring's org.springframework.util.ResourceUtils class. It has a method called getURL which accepts a String with classpath prefix. But inside the method, it cuts the classpath prefix and tries to lookup with the help of the class loader. |
|
Any update on this pull request? If not, we will close this one in a few days. |
@mp911de sorry. I will update it on weekends. |
@mp911de I have pushed my last changes. Could you review it, please? |
@isabek can we also update the README to reflect this option ? |
} | ||
|
||
ClassLoader classLoader = Assert.class.getClassLoader(); | ||
URL url = classLoader != null ? classLoader.getResource(path) : ClassLoader.getSystemResource(path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How is the classloader supposed to be null?
* @throws IllegalArgumentException if {@code value} is not of the required type | ||
* @throws IllegalArgumentException if {@code value}, {@code type}, or {@code message} is {@code null} | ||
*/ | ||
public static URL requireUrlExistsOrNull(@Nullable String path, String message) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should revert changes to the Assert
class and instead, introduce rather an utility method to figure out, whether the given ConnectionFactoryOption
tries to point to a real file or to a URL. Checking for a scheme would be a good approach if the configured string doesn't point to a file.
We might still run into an ambiguity on windows (c:\foo\bar.crt
vs. classpath:foo.crt
or classpath:/foo
). Not sure how to resolve that.
@isabek I'm happy to take this PR from here as it requires a bit of experimentation. WDYT? |
Sure. |
We now try to resolve SSL certificates first from the class path and then fall back to files when providing a path as string. [resolves #313][closes #318] Signed-off-by: Mark Paluch <[email protected]>
Thank you for your contribution. That's merged, polished, and backported now. |
[resolves #313]
Make sure that:
Issue description
New Public APIs
Additional context