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

[EDGORDERS-83-ENV]. Refactor for TLS configuration for Spring-based Environment #105

Merged
merged 17 commits into from
May 24, 2024
Merged
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
ea7c4aa
[EDGORDERS-83-ENV]. Refactor for TLS configuration for Spring-based E…
BKadirkhodjaev May 23, 2024
ceb6c2a
[EDGORDERS-83-ENV]. Fix broken contract with old properties
BKadirkhodjaev May 23, 2024
2de0154
[EDGORDERS-83-ENV]. Add missing env var
BKadirkhodjaev May 24, 2024
f74c9d8
[EDGORDERS-83-ENV]. Update README.md
BKadirkhodjaev May 24, 2024
210f5bc
[EDGRTAC-86-ENV]. Update Constants comments
BKadirkhodjaev May 24, 2024
3f3f768
[EDGORDERS-83-ENV]. Add web server key alias Env var, change Spring W…
BKadirkhodjaev May 24, 2024
aa90aed
[EDGORDERS-83-ENV]. Change WebClient env vars, update README.md
BKadirkhodjaev May 24, 2024
00d31c2
[EDGORDERS-83-ENV]. Update web server key alias, update README.md
BKadirkhodjaev May 24, 2024
18516ad
[EDGORDERS-83-ENV]. Update web server key alias, update README.md
BKadirkhodjaev May 24, 2024
3a98da0
[EDGORDERS-83-ENV]. Remove redundant checks
BKadirkhodjaev May 24, 2024
1d3fabf
[EDGORDERS-83-ENV]. Remove redundant checks
BKadirkhodjaev May 24, 2024
b010352
[EDGORDERS-83-ENV]. Add key alias password prop
BKadirkhodjaev May 24, 2024
1866af9
[EDGORDERS-83-ENV]. Update env vars to be Linux compliant
BKadirkhodjaev May 24, 2024
397cd95
[EDGORDERS-83-ENV]. Refactor variable names for better indication
BKadirkhodjaev May 24, 2024
25ab766
[EDGORDERS-83-ENV]. Update README.md
BKadirkhodjaev May 24, 2024
f43d9a5
Merge branch 'master' into EDGORDERS-83-ENV
BKadirkhodjaev May 24, 2024
80bf4da
[EDGORDERS-83-ENV]. Update README.md
BKadirkhodjaev May 24, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 17 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,34 +165,30 @@ Configuration information is specified in two forms:
| `request_timeout_ms` | `30000` | Request Timeout |
| `api_key_sources` | `PARAM,HEADER,PATH` | Defines the sources (order of precendence) of the API key. |

### System Properties for TLS configuration for Http server
### Env variables for TLS configuration for Http server

To configure Transport Layer Security (TLS) for the HTTP server in an edge module, the following configuration parameters should be used.
BKadirkhodjaev marked this conversation as resolved.
Show resolved Hide resolved
Parameters marked as Required are required only in case when ssl_enabled is set to true.
Copy link
Contributor

Choose a reason for hiding this comment

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

ssl_enabled has been replaced with checking whether SPRING_SSL_BUNDLE_JKS_WEBSERVER_KEYSTORE_TYPE is defined.


| Property | Default | Description |
|-----------------------------------|-------------------|---------------------------------------------------------------------------------------------|
| `http-server.ssl_enabled` | `false` | Set whether SSL/TLS is enabled for Vertx Http Server |
| `http-server.keystore_type` | `NA` | (Required). Set the type of the keystore. Common types include `JKS`, `PKCS12`, and `BCFKS` |
| `http-server.keystore_provider` | `NA` | Set the provider name of the key store |
| `http-server.keystore_path` | `NA` | (Required). Set the location of the keystore file in the local file system |
| `http-server.keystore_password` | `NA` | (Required). Set the password for the keystore |
| `http-server.key_alias` | `NA` | Set the alias of the key within the keystore. |
| `http-server.key_alias_password` | `NA` | Optional param that points to a password of `key_alias` if it protected |

### System Properties for TLS configuration for Web Client
| Property | Default | Description |
|-------------------------------------------------------|-------------------|---------------------------------------------------------------------------------------------|
| `SPRING_SSL_BUNDLE_JKS_WEB-SERVER_KEYSTORE_TYPE` | `NA` | (Required). Set the type of the keystore. Common types include `JKS`, `PKCS12`, and `BCFKS` |
| `SPRING_SSL_BUNDLE_JKS_WEB-SERVER_KEYSTORE_PATH` | `NA` | (Required). Set the location of the keystore file in the local file system |
| `SPRING_SSL_BUNDLE_JKS_WEB-SERVER_KEYSTORE_PASSWORD` | `NA` | (Required). Set the password for the keystore |
| `SPRING_SSL_BUNDLE_JKS_WEB-SERVER_KEY_ALIAS` | `NA` | Set the alias of the key within the keystore. |

### Env variables for TLS configuration for Web Client
azizbekxm marked this conversation as resolved.
Show resolved Hide resolved

To configure Transport Layer Security (TLS) for Web clients in the edge module, you can use the following configuration parameters.
Truststore parameters for configuring Web clients are optional even when ssl_enabled = true.
If truststore parameters need to be populated, truststore_type, truststore_path and truststore_password are required.

| Property | Default | Description |
|-----------------------------------|-------------------|----------------------------------------------------------------------------------|
| `web-client.ssl_enabled` | `false` | Set whether SSL/TLS is enabled for Vertx Http Server |
| `web-client.truststore_type` | `NA` | Set the type of the keystore. Common types include `JKS`, `PKCS12`, and `BCFKS` |
| `web-client.truststore_provider` | `NA` | Set the provider name of the key store |
| `web-client.truststore_path` | `NA` | Set the location of the keystore file in the local file system |
| `web-client.truststore_password` | `NA` | Set the password for the keystore |
| `web-client.key_alias` | `NA` | Set the alias of the key within the keystore. |
| `web-client.key_alias_password` | `NA` | Optional param that points to a password of `key_alias` if it protected |
| Property | Default | Description |
|-----------------------------------------|-------------------|----------------------------------------------------------------------------------|
| `FOLIO_CLIENT_TLS_ENABLED` | `false` | Set whether SSL/TLS is enabled for Vertx Http Server |
| `FOLIO_CLIENT_TLS_TRUSTSTORETYPE` | `NA` | Set the type of the keystore. Common types include `JKS`, `PKCS12`, and `BCFKS` |
| `FOLIO_CLIENT_TLS_TRUSTSTOREPATH` | `NA` | Set the location of the keystore file in the local file system |
| `FOLIO_CLIENT_TLS_TRUSTSTOREPASSWORD` | `NA` | Set the password for the keystore |


## Additional information
Expand Down
86 changes: 34 additions & 52 deletions src/main/java/org/folio/edge/core/Constants.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,22 +25,17 @@ private Constants() {
public static final String SYS_API_KEY_SOURCES = "api_key_sources";
public static final String SYS_RESPONSE_COMPRESSION = "response_compression";

// System properties for SSL/TLS http server configuration
public static final String SYS_HTTP_SERVER_SSL_ENABLED = "http-server.ssl_enabled";
public static final String SYS_HTTP_SERVER_KEYSTORE_TYPE = "http-server.keystore_type";
public static final String SYS_HTTP_SERVER_KEYSTORE_PROVIDER = "http-server.keystore_provider";
public static final String SYS_HTTP_SERVER_KEYSTORE_PATH = "http-server.keystore_path";
public static final String SYS_HTTP_SERVER_KEYSTORE_PASSWORD = "http-server.keystore_password";
public static final String SYS_HTTP_SERVER_KEY_ALIAS = "http-server.key_alias";
public static final String SYS_HTTP_SERVER_KEY_ALIAS_PASSWORD = "http-server.key_alias_password";
public static final String SYS_WEB_CLIENT_SSL_ENABLED = "web-client.ssl_enabled";
// System properties for SSL/TLS web client configuration
public static final String SYS_WEB_CLIENT_TRUSTSTORE_TYPE = "web-client.truststore_type";
public static final String SYS_WEB_CLIENT_TRUSTSTORE_PROVIDER = "web-client.truststore_provider";
public static final String SYS_WEB_CLIENT_TRUSTSTORE_PATH = "web-client.truststore_path";
public static final String SYS_WEB_CLIENT_TRUSTSTORE_PASSWORD = "web-client.truststore_password";
public static final String SYS_WEB_CLIENT_KEY_ALIAS = "web-client.key_alias";
public static final String SYS_WEB_CLIENT_KEY_ALIAS_PASSWORD = "web-client.key_alias_password";
// Env variables for SSL/TLS http server configuration
public static final String SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEYSTORE_TYPE = "SPRING_SSL_BUNDLE_JKS_WEB-SERVER_KEYSTORE_TYPE";
public static final String SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEYSTORE_PATH = "SPRING_SSL_BUNDLE_JKS_WEB-SERVER_KEYSTORE_PATH";
public static final String SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEYSTORE_PASSWORD = "SPRING_SSL_BUNDLE_JKS_WEB-SERVER_KEYSTORE_PASSWORD";
public static final String SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEY_ALIAS = "SPRING_SSL_BUNDLE_JKS_WEB-SERVER_KEY_ALIAS";

SerhiiNosko marked this conversation as resolved.
Show resolved Hide resolved
// Env variables for SSL/TLS web client configuration
public static final String FOLIO_CLIENT_TLS_ENABLED = "FOLIO_CLIENT_TLS_ENABLED";
public static final String FOLIO_CLIENT_TLS_TRUST_STORE_TYPE = "FOLIO_CLIENT_TLS_TRUSTSTORETYPE";
public static final String FOLIO_CLIENT_TLS_TRUST_STORE_PATH = "FOLIO_CLIENT_TLS_TRUSTSTOREPATH";
public static final String FOLIO_CLIENT_TLS_TRUST_STORE_PASSWORD = "FOLIO_CLIENT_TLS_TRUSTSTOREPASSWORD";
Copy link
Contributor

Choose a reason for hiding this comment

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

Renaming the variable name gives a better indication of the content:
TRUST_STORE_TYPE -> TRUSTSTORETYPE
TRUST_STORE_PATH -> TRUSTSTOREPATH
TRUST_STORE_PASSWORD -> TRUSTSTOREPASSWORD

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Acknowledged


// Property names
public static final String PROP_SECURE_STORE_TYPE = "secureStore.type";
Expand Down Expand Up @@ -100,51 +95,38 @@ private Constants() {
System.getProperty(SYS_API_KEY_SOURCES, DEFAULT_API_KEY_SOURCES));
defaultMap.put(SYS_REQUEST_TIMEOUT_MS,
Long.parseLong(System.getProperty(SYS_REQUEST_TIMEOUT_MS,
Long.toString(DEFAULT_REQUEST_TIMEOUT_MS))));
Long.toString(DEFAULT_REQUEST_TIMEOUT_MS))));
defaultMap.put(SYS_TOKEN_CACHE_TTL_MS,
Long.parseLong(System.getProperty(SYS_TOKEN_CACHE_TTL_MS,
Long.toString(DEFAULT_TOKEN_CACHE_TTL_MS))));
Long.toString(DEFAULT_TOKEN_CACHE_TTL_MS))));
defaultMap.put(SYS_NULL_TOKEN_CACHE_TTL_MS,
Long.parseLong(System.getProperty(SYS_NULL_TOKEN_CACHE_TTL_MS,
Long.toString(DEFAULT_NULL_TOKEN_CACHE_TTL_MS))));
Long.toString(DEFAULT_NULL_TOKEN_CACHE_TTL_MS))));
defaultMap.put(SYS_TOKEN_CACHE_CAPACITY,
Integer.parseInt(System.getProperty(SYS_TOKEN_CACHE_CAPACITY,
Integer.toString(DEFAULT_TOKEN_CACHE_CAPACITY))));
Integer.toString(DEFAULT_TOKEN_CACHE_CAPACITY))));
defaultMap.put(SYS_SECURE_STORE_TYPE,
System.getProperty(SYS_SECURE_STORE_TYPE, DEFAULT_SECURE_STORE_TYPE));
System.getProperty(SYS_SECURE_STORE_TYPE, DEFAULT_SECURE_STORE_TYPE));
defaultMap.put(SYS_RESPONSE_COMPRESSION,
Boolean.parseBoolean(System.getProperty(SYS_RESPONSE_COMPRESSION,
Boolean.toString(DEFAULT_RESPONSE_COMPRESSION))));
defaultMap.put(SYS_HTTP_SERVER_SSL_ENABLED,
Boolean.parseBoolean(System.getProperty(SYS_HTTP_SERVER_SSL_ENABLED,
Boolean.toString(DEFAULT_SSL_ENABLED))));
defaultMap.put(SYS_HTTP_SERVER_KEYSTORE_TYPE,
System.getProperty(SYS_HTTP_SERVER_KEYSTORE_TYPE));
defaultMap.put(SYS_HTTP_SERVER_KEYSTORE_PROVIDER,
System.getProperty(SYS_HTTP_SERVER_KEYSTORE_PROVIDER));
defaultMap.put(SYS_HTTP_SERVER_KEYSTORE_PATH,
System.getProperty(SYS_HTTP_SERVER_KEYSTORE_PATH));
defaultMap.put(SYS_HTTP_SERVER_KEYSTORE_PASSWORD,
System.getProperty(SYS_HTTP_SERVER_KEYSTORE_PASSWORD));
defaultMap.put(SYS_HTTP_SERVER_KEY_ALIAS,
System.getProperty(SYS_HTTP_SERVER_KEY_ALIAS));
defaultMap.put(SYS_HTTP_SERVER_KEY_ALIAS_PASSWORD,
System.getProperty(SYS_HTTP_SERVER_KEY_ALIAS_PASSWORD));
defaultMap.put(SYS_WEB_CLIENT_SSL_ENABLED,
Boolean.parseBoolean(System.getProperty(SYS_WEB_CLIENT_SSL_ENABLED,
Boolean.toString(DEFAULT_SSL_ENABLED))));
defaultMap.put(SYS_WEB_CLIENT_TRUSTSTORE_TYPE,
System.getProperty(SYS_WEB_CLIENT_TRUSTSTORE_TYPE));
defaultMap.put(SYS_WEB_CLIENT_TRUSTSTORE_PROVIDER,
System.getProperty(SYS_WEB_CLIENT_TRUSTSTORE_PROVIDER));
defaultMap.put(SYS_WEB_CLIENT_TRUSTSTORE_PATH,
System.getProperty(SYS_WEB_CLIENT_TRUSTSTORE_PATH));
defaultMap.put(SYS_WEB_CLIENT_TRUSTSTORE_PASSWORD,
System.getProperty(SYS_WEB_CLIENT_TRUSTSTORE_PASSWORD));
defaultMap.put(SYS_WEB_CLIENT_KEY_ALIAS,
System.getProperty(SYS_WEB_CLIENT_KEY_ALIAS));
defaultMap.put(SYS_WEB_CLIENT_KEY_ALIAS_PASSWORD,
System.getProperty(SYS_WEB_CLIENT_KEY_ALIAS_PASSWORD));
Boolean.toString(DEFAULT_RESPONSE_COMPRESSION))));
defaultMap.put(SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEYSTORE_TYPE,
System.getenv().get(SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEYSTORE_TYPE));
defaultMap.put(SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEYSTORE_PATH,
System.getenv().get(SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEYSTORE_PATH));
defaultMap.put(SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEYSTORE_PASSWORD,
System.getenv().get(SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEYSTORE_PASSWORD));
defaultMap.put(SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEY_ALIAS,
System.getenv().get(SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEY_ALIAS));
defaultMap.put(FOLIO_CLIENT_TLS_ENABLED,
Boolean.parseBoolean(System.getenv().getOrDefault(FOLIO_CLIENT_TLS_ENABLED,
Boolean.toString(DEFAULT_SSL_ENABLED))));
defaultMap.put(FOLIO_CLIENT_TLS_TRUST_STORE_TYPE,
System.getenv().get(FOLIO_CLIENT_TLS_TRUST_STORE_TYPE));
defaultMap.put(FOLIO_CLIENT_TLS_TRUST_STORE_PATH,
System.getenv().get(FOLIO_CLIENT_TLS_TRUST_STORE_PATH));
defaultMap.put(FOLIO_CLIENT_TLS_TRUST_STORE_PASSWORD,
System.getenv().get(FOLIO_CLIENT_TLS_TRUST_STORE_PASSWORD));
defaultMap.put(SYS_SECURE_STORE_PROP_FILE,
System.getProperty(SYS_SECURE_STORE_PROP_FILE));
defaultMap.put(SYS_OKAPI_URL,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@

import static org.folio.edge.core.Constants.SYS_OKAPI_URL;
import static org.folio.edge.core.Constants.SYS_REQUEST_TIMEOUT_MS;
import static org.folio.edge.core.Constants.SYS_WEB_CLIENT_KEY_ALIAS;
import static org.folio.edge.core.Constants.SYS_WEB_CLIENT_KEY_ALIAS_PASSWORD;
import static org.folio.edge.core.Constants.SYS_WEB_CLIENT_SSL_ENABLED;
import static org.folio.edge.core.Constants.SYS_WEB_CLIENT_TRUSTSTORE_PASSWORD;
import static org.folio.edge.core.Constants.SYS_WEB_CLIENT_TRUSTSTORE_PATH;
import static org.folio.edge.core.Constants.SYS_WEB_CLIENT_TRUSTSTORE_PROVIDER;
import static org.folio.edge.core.Constants.SYS_WEB_CLIENT_TRUSTSTORE_TYPE;
import static org.folio.edge.core.Constants.FOLIO_CLIENT_TLS_ENABLED;
import static org.folio.edge.core.Constants.FOLIO_CLIENT_TLS_TRUST_STORE_PASSWORD;
import static org.folio.edge.core.Constants.FOLIO_CLIENT_TLS_TRUST_STORE_PATH;
import static org.folio.edge.core.Constants.FOLIO_CLIENT_TLS_TRUST_STORE_TYPE;

import com.amazonaws.util.StringUtils;
import io.vertx.core.Vertx;
Expand All @@ -27,27 +24,21 @@ private OkapiClientFactoryInitializer() {
public static OkapiClientFactory createInstance(Vertx vertx, JsonObject config) {
String okapiUrl = config.getString(SYS_OKAPI_URL);
Integer requestTimeout = config.getInteger(SYS_REQUEST_TIMEOUT_MS);
boolean isSslEnabled = config.getBoolean(SYS_WEB_CLIENT_SSL_ENABLED);
boolean isSslEnabled = config.getBoolean(FOLIO_CLIENT_TLS_ENABLED);
if (isSslEnabled) {
logger.info("Creating OkapiClientFactory with Enhance HTTP Endpoint Security and TLS mode enabled");
String truststoreType = config.getString(SYS_WEB_CLIENT_TRUSTSTORE_TYPE);
String truststoreProvider = config.getString(SYS_WEB_CLIENT_TRUSTSTORE_PROVIDER);
String truststorePath = config.getString(SYS_WEB_CLIENT_TRUSTSTORE_PATH);
String truststorePassword = config.getString(SYS_WEB_CLIENT_TRUSTSTORE_PASSWORD);
String keyAlias = config.getString(SYS_WEB_CLIENT_KEY_ALIAS);
String keyAliasPassword = config.getString(SYS_WEB_CLIENT_KEY_ALIAS_PASSWORD);
String truststoreType = config.getString(FOLIO_CLIENT_TLS_TRUST_STORE_TYPE);
String truststorePath = config.getString(FOLIO_CLIENT_TLS_TRUST_STORE_PATH);
String truststorePassword = config.getString(FOLIO_CLIENT_TLS_TRUST_STORE_PASSWORD);
if (!StringUtils.isNullOrEmpty(truststoreType)
&& !StringUtils.isNullOrEmpty(truststorePath)
&& !StringUtils.isNullOrEmpty(truststorePassword)) {

logger.info("Web client truststore options for type: {} are set, configuring Web Client with them", truststoreType);
TrustOptions trustOptions = new KeyStoreOptions()
.setType(truststoreType)
.setProvider(truststoreProvider)
.setPath(truststorePath)
.setPassword(truststorePassword)
.setAlias(keyAlias)
.setAliasPassword(keyAliasPassword);
.setPassword(truststorePassword);
return new OkapiClientFactory(vertx, okapiUrl, requestTimeout, trustOptions);
} else {
return new OkapiClientFactory(vertx, okapiUrl, requestTimeout, null);
Expand Down
34 changes: 13 additions & 21 deletions src/main/java/org/folio/edge/core/utils/SslConfigurationUtil.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package org.folio.edge.core.utils;

import static org.folio.edge.core.Constants.SYS_HTTP_SERVER_KEYSTORE_PASSWORD;
import static org.folio.edge.core.Constants.SYS_HTTP_SERVER_KEYSTORE_PATH;
import static org.folio.edge.core.Constants.SYS_HTTP_SERVER_KEYSTORE_PROVIDER;
import static org.folio.edge.core.Constants.SYS_HTTP_SERVER_KEYSTORE_TYPE;
import static org.folio.edge.core.Constants.SYS_HTTP_SERVER_KEY_ALIAS;
import static org.folio.edge.core.Constants.SYS_HTTP_SERVER_KEY_ALIAS_PASSWORD;
import static org.folio.edge.core.Constants.SYS_HTTP_SERVER_SSL_ENABLED;
import static org.folio.edge.core.Constants.SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEYSTORE_PASSWORD;
import static org.folio.edge.core.Constants.SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEYSTORE_PATH;
import static org.folio.edge.core.Constants.SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEYSTORE_TYPE;
import static org.folio.edge.core.Constants.SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEY_ALIAS;

import com.amazonaws.util.StringUtils;
import io.vertx.core.json.JsonObject;
Expand All @@ -21,35 +18,30 @@ public class SslConfigurationUtil {
private SslConfigurationUtil() {}

public static void configureSslServerOptionsIfEnabled(JsonObject config, NetServerOptions serverOptions) {
final boolean isSslEnabled = config.getBoolean(SYS_HTTP_SERVER_SSL_ENABLED);
final boolean isSslEnabled = !StringUtils.isNullOrEmpty(config.getString(SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEYSTORE_TYPE));
if (isSslEnabled) {
logger.info("Enabling Vertx Http Server with TLS/SSL configuration...");
serverOptions.setSsl(true);
String keystoreType = config.getString(SYS_HTTP_SERVER_KEYSTORE_TYPE);
String keystoreType = config.getString(SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEYSTORE_TYPE);
if (StringUtils.isNullOrEmpty(keystoreType)) {
SerhiiNosko marked this conversation as resolved.
Show resolved Hide resolved
throw new IllegalStateException("'keystore_type' system param must be specified when ssl_enabled = true");
throw new IllegalStateException("'SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEYSTORE_TYPE' system param must be specified");
}
logger.info("Using {} keystore type for SSL/TLS", keystoreType);
String keystoreProvider = config.getString(SYS_HTTP_SERVER_KEYSTORE_PROVIDER);
logger.info("Using {} keystore provider for SSL/TLS", keystoreProvider);
String keystorePath = config.getString(SYS_HTTP_SERVER_KEYSTORE_PATH);
String keystorePath = config.getString(SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEYSTORE_PATH);
if (StringUtils.isNullOrEmpty(keystorePath)) {
throw new IllegalStateException("'keystore_path' system param must be specified when ssl_enabled = true");
throw new IllegalStateException("'SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEYSTORE_PATH' system param must be specified");
}
String keystorePassword = config.getString(SYS_HTTP_SERVER_KEYSTORE_PASSWORD);
String keystorePassword = config.getString(SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEYSTORE_PASSWORD);
if (StringUtils.isNullOrEmpty(keystorePassword)) {
throw new IllegalStateException("'keystore_password' system param must be specified when ssl_enabled = true");
throw new IllegalStateException("'SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEYSTORE_PASSWORD' system param must be specified");
}
String keyAlias = config.getString(SYS_HTTP_SERVER_KEY_ALIAS);
String keyAliasPassword = config.getString(SYS_HTTP_SERVER_KEY_ALIAS_PASSWORD);
String keyAlias = config.getString(SPRING_SSL_BUNDLE_JKS_WEB_SERVER_KEY_ALIAS);

serverOptions.setKeyCertOptions(new KeyStoreOptions()
.setType(keystoreType)
.setProvider(keystoreProvider)
.setPath(keystorePath)
.setPassword(keystorePassword)
.setAlias(keyAlias)
.setAliasPassword(keyAliasPassword));
.setAlias(keyAlias));
}
}
}
Loading