From 6cafc19c9b4ea0d5ee5f2b7992394a7fceb40f8f Mon Sep 17 00:00:00 2001 From: Ryan Liang Date: Wed, 16 Aug 2023 13:31:57 -0700 Subject: [PATCH] Modify the getDynamicOnBehalfOfSettings() to return settings.Empty if there is no changes Signed-off-by: Ryan Liang --- .../onbehalf/CreateOnBehalfOfTokenAction.java | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/main/java/org/opensearch/security/action/onbehalf/CreateOnBehalfOfTokenAction.java b/src/main/java/org/opensearch/security/action/onbehalf/CreateOnBehalfOfTokenAction.java index c5862a1537..3e67ae859c 100644 --- a/src/main/java/org/opensearch/security/action/onbehalf/CreateOnBehalfOfTokenAction.java +++ b/src/main/java/org/opensearch/security/action/onbehalf/CreateOnBehalfOfTokenAction.java @@ -61,16 +61,13 @@ public void onDynamicConfigModelChanged(DynamicConfigModel dcm) { this.dcm = dcm; Settings settings = dcm.getDynamicOnBehalfOfSettings(); - if (settings != null) { - Boolean enabled = Boolean.parseBoolean(settings.get("enabled")); - String signingKey = settings.get("signing_key"); - String encryptionKey = settings.get("encryption_key"); - - if (!Boolean.FALSE.equals(enabled) && signingKey != null && encryptionKey != null) { - this.vendor = new JwtVendor(settings, Optional.empty()); - } else { - this.vendor = null; - } + + Boolean enabled = Boolean.parseBoolean(settings.get("enabled")); + String signingKey = settings.get("signing_key"); + String encryptionKey = settings.get("encryption_key"); + + if (!Boolean.FALSE.equals(enabled) && signingKey != null && encryptionKey != null) { + this.vendor = new JwtVendor(settings, Optional.empty()); } else { this.vendor = null; }