Skip to content

Commit

Permalink
Modify the getDynamicOnBehalfOfSettings() to return settings.Empty if…
Browse files Browse the repository at this point in the history
… there is no changes

Signed-off-by: Ryan Liang <[email protected]>
  • Loading branch information
RyanL1997 committed Aug 16, 2023
1 parent b64f7e1 commit 9b57e1b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,10 @@ public Multimap<String, ClientBlockRegistry<String>> getAuthBackendClientBlockRe

@Override
public Settings getDynamicOnBehalfOfSettings() {
return Settings.builder()
Settings settings = Settings.builder()
.put(Settings.builder().loadFromSource(config.dynamic.on_behalf_of.configAsJson(), XContentType.JSON).build())
.build();
return settings != null ? settings : Settings.EMPTY;
}

private void buildAAA() {
Expand Down

0 comments on commit 9b57e1b

Please sign in to comment.