risdenk commented on code in PR #1284:
URL: https://github.com/apache/solr/pull/1284#discussion_r1066221224
##########
solr/modules/jwt-auth/src/java/org/apache/solr/security/jwt/JWTAuthPlugin.java:
##########
@@ -297,6 +283,54 @@ public void init(Map<String, Object> pluginConfig) {
lastInitTime = Instant.now();
}
+ /**
+ * Given a configuration object of a file name or list of file names, read
X509 certificates from
+ * each file
+ */
+ @SuppressWarnings("unchecked")
Review Comment:
What is unchecked here?
##########
solr/modules/jwt-auth/src/java/org/apache/solr/security/jwt/JWTAuthPlugin.java:
##########
@@ -297,6 +283,54 @@ public void init(Map<String, Object> pluginConfig) {
lastInitTime = Instant.now();
}
+ /**
+ * Given a configuration object of a file name or list of file names, read
X509 certificates from
+ * each file
+ */
+ @SuppressWarnings("unchecked")
+ Collection<X509Certificate> readSslCertsFromFileOrList(Object
trustedCertsFileObj) {
+ Collection<X509Certificate> certs = new HashSet<>();
+ if (trustedCertsFileObj instanceof String) {
+ String trustedCertsFile = (String) trustedCertsFileObj;
+ log.info("Reading trustedCerts from file {}", trustedCertsFile);
+ try {
+ certs.addAll(parseCertsFromFile(trustedCertsFile));
+ } catch (IOException e) {
+ throw new SolrException(
+ SolrException.ErrorCode.SERVER_ERROR, "Failed to read file " +
trustedCertsFile, e);
+ }
Review Comment:
Couldn't you just make this string into a List of one and use the same logic
as the list? That would simplify and remove the duplications.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]