Skip to content

Commit

Permalink
mvn spotless:apply
Browse files Browse the repository at this point in the history
  • Loading branch information
mwangggg committed Aug 9, 2024
1 parent 8ea230c commit 79925c4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
18 changes: 12 additions & 6 deletions src/main/java/io/cryostat/agent/ConfigModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
package io.cryostat.agent;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.InetAddress;
import java.net.URI;
Expand Down Expand Up @@ -49,7 +48,6 @@

import dagger.Module;
import dagger.Provides;

import org.apache.commons.io.IOUtils;
import org.eclipse.microprofile.config.Config;
import org.eclipse.microprofile.config.ConfigProvider;
Expand Down Expand Up @@ -277,8 +275,12 @@ public static Optional<String> provideCryostatAgentWebclientTlsTruststorePath(Co
@Provides
@Singleton
@Named(CRYOSTAT_AGENT_WEBCLIENT_TLS_TRUSTSTORE_PASS_FILE)
public static Optional<String> provideCryostatAgentWebclientTlsTruststorePassFromFile(Config config, @Named(CRYOSTAT_AGENT_WEBCLIENT_TLS_TRUSTSTORE_PASS_CHARSET) String passCharset) {
Optional<String> truststorePassFile = config.getOptionalValue(CRYOSTAT_AGENT_WEBCLIENT_TLS_TRUSTSTORE_PASS_FILE, String.class);
public static Optional<String> provideCryostatAgentWebclientTlsTruststorePassFromFile(
Config config,
@Named(CRYOSTAT_AGENT_WEBCLIENT_TLS_TRUSTSTORE_PASS_CHARSET) String passCharset) {
Optional<String> truststorePassFile =
config.getOptionalValue(
CRYOSTAT_AGENT_WEBCLIENT_TLS_TRUSTSTORE_PASS_FILE, String.class);
Optional<String> password = Optional.empty();
try (FileInputStream passFile = new FileInputStream(truststorePassFile.get())) {
String pass = IOUtils.toString(passFile, Charset.forName(passCharset));
Expand All @@ -300,8 +302,12 @@ public static String provideCryostatAgentWebclientTlsTruststorePassCharset(Confi
@Provides
@Singleton
@Named(CRYOSTAT_AGENT_WEBCLIENT_TLS_TRUSTSTORE_PASS)
public static Optional<String> provideCryostatAgentWebclientTlsTruststorePass(Config config, @Named(CRYOSTAT_AGENT_WEBCLIENT_TLS_TRUSTSTORE_PASS_FILE) Optional<String> truststorePass) {
Optional<String> opt = config.getOptionalValue(CRYOSTAT_AGENT_WEBCLIENT_TLS_TRUSTSTORE_PASS, String.class);
public static Optional<String> provideCryostatAgentWebclientTlsTruststorePass(
Config config,
@Named(CRYOSTAT_AGENT_WEBCLIENT_TLS_TRUSTSTORE_PASS_FILE)
Optional<String> truststorePass) {
Optional<String> opt =
config.getOptionalValue(CRYOSTAT_AGENT_WEBCLIENT_TLS_TRUSTSTORE_PASS, String.class);
return opt.or(() -> truststorePass);
}

Expand Down
8 changes: 5 additions & 3 deletions src/main/java/io/cryostat/agent/MainModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,10 @@ public static WebServer provideWebServer(
public static SSLContext provideClientSslContext(
@Named(ConfigModule.CRYOSTAT_AGENT_WEBCLIENT_TLS_VERSION) String clientTlsVersion,
@Named(ConfigModule.CRYOSTAT_AGENT_WEBCLIENT_TLS_TRUST_ALL) boolean trustAll,
@Named(ConfigModule.CRYOSTAT_AGENT_WEBCLIENT_TLS_TRUSTSTORE_PATH) Optional<String> truststorePath,
@Named(ConfigModule.CRYOSTAT_AGENT_WEBCLIENT_TLS_TRUSTSTORE_PASS) Optional<String> truststorePass,
@Named(ConfigModule.CRYOSTAT_AGENT_WEBCLIENT_TLS_TRUSTSTORE_PATH)
Optional<String> truststorePath,
@Named(ConfigModule.CRYOSTAT_AGENT_WEBCLIENT_TLS_TRUSTSTORE_PASS)
Optional<String> truststorePass,
@Named(ConfigModule.CRYOSTAT_AGENT_WEBCLIENT_TLS_TRUSTSTORE_TYPE) String truststoreType,
@Named(ConfigModule.CRYOSTAT_AGENT_WEBCLIENT_TLS_TRUSTSTORE_CERTS)
List<TruststoreConfig> truststoreCerts) {
Expand Down Expand Up @@ -190,7 +192,7 @@ public X509Certificate[] getAcceptedIssuers() {
}
}

//initialize truststore with user provided certs
// initialize truststore with user provided certs
for (TruststoreConfig truststore : truststoreCerts) {
// load truststore with certificatesCertificate
InputStream certFile = new FileInputStream(truststore.getPath());
Expand Down

0 comments on commit 79925c4

Please sign in to comment.