Skip to content

Commit fd38d23

Browse files
kumargucwperks
andauthored
Decouple the init of Crypto Plugin and KeyProvider in Registry (#18270)
Signed-off-by: Gulshan <kumargu@amazon.com> Signed-off-by: Gulshan Kumar <kumargu@amazon.com> Signed-off-by: Craig Perkins <cwperx@amazon.com> Co-authored-by: Craig Perkins <cwperx@amazon.com>
1 parent 1c4ac46 commit fd38d23

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
2121
- Enable testing for ExtensiblePlugins using classpath plugins ([#16908](https://github.com/opensearch-project/OpenSearch/pull/16908))
2222
- Introduce system generated ingest pipeline ([#17817](https://github.com/opensearch-project/OpenSearch/pull/17817)))
2323
- Support create mode in pull-based ingestion and add retries for transient failures ([#18250](https://github.com/opensearch-project/OpenSearch/pull/18250)))
24+
- Decouple the init of Crypto Plugin and KeyProvider in CryptoRegistry ([18270](https://github.com/opensearch-project/OpenSearch/pull18270)))
2425

2526
### Changed
2627

server/src/main/java/org/opensearch/crypto/CryptoHandlerRegistry.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -52,16 +52,17 @@ protected CryptoHandlerRegistry(
5252
List<CryptoKeyProviderPlugin> cryptoKeyProviderPlugins,
5353
Settings settings
5454
) {
55-
if (cryptoPlugins == null || cryptoPlugins.size() == 0) {
56-
return;
57-
}
58-
if (cryptoPlugins.size() > 1) {
59-
// We can remove this to support multiple implementations in future if needed.
60-
throw new IllegalStateException("More than 1 implementation of crypto plugin found.");
55+
if (cryptoPlugins != null && !cryptoPlugins.isEmpty()) {
56+
if (cryptoPlugins.size() > 1) {
57+
// We can remove this to support multiple implementations in future if needed.
58+
throw new IllegalStateException("More than 1 implementation of crypto plugin found.");
59+
}
60+
cryptoHandlerPlugin.set(cryptoPlugins.get(0));
6161
}
6262

63-
cryptoHandlerPlugin.set(cryptoPlugins.get(0));
64-
registry.set(loadCryptoFactories(cryptoKeyProviderPlugins));
63+
if (cryptoKeyProviderPlugins != null && !cryptoKeyProviderPlugins.isEmpty()) {
64+
registry.set(loadCryptoFactories(cryptoKeyProviderPlugins));
65+
}
6566
}
6667

6768
public static CryptoHandlerRegistry getInstance() {

0 commit comments

Comments
 (0)