Skip to content

Commit

Permalink
combine conditions
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Dec 20, 2024
1 parent 96f6c7f commit 2ab27ca
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/main/java/io/cryostat/agent/MainModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -241,15 +241,13 @@ public static SSLContext provideClientSslContext(
@Named(ConfigModule.CRYOSTAT_AGENT_WEBCLIENT_TLS_REQUIRED) boolean tlsRequired) {
try {
KeyManager[] keyManagers = null;
if (tlsRequired) {
if (!baseUri.getScheme().equals("https")) {
throw new IllegalArgumentException(
String.format(
"If TLS is enabled via the (%s) property, the base URI (%s)"
+ " must be an https connection.",
ConfigModule.CRYOSTAT_AGENT_WEBCLIENT_TLS_REQUIRED,
ConfigModule.CRYOSTAT_AGENT_BASEURI));
}
if (tlsRequired && !baseUri.getScheme().equals("https")) {
throw new IllegalArgumentException(
String.format(
"If TLS is enabled via the (%s) property, the base URI (%s)"
+ " must be an https connection.",
ConfigModule.CRYOSTAT_AGENT_WEBCLIENT_TLS_REQUIRED,
ConfigModule.CRYOSTAT_AGENT_BASEURI));
}
if (clientAuthCertPath.isPresent() && clientAuthKeyPath.isPresent()) {
KeyStore ks = KeyStore.getInstance(clientAuthKeystoreType);
Expand Down

0 comments on commit 2ab27ca

Please sign in to comment.