-
Notifications
You must be signed in to change notification settings - Fork 292
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
Extensions config for JWT signing/encryption key #2671
Changes from all commits
77ac374
59120d9
eca8bff
999b5ac
d163cb0
1bb0366
4689085
b98bbc5
2b80cbe
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,7 @@ | |
import com.fasterxml.jackson.annotation.JsonAnySetter; | ||
import com.fasterxml.jackson.annotation.JsonIgnore; | ||
import com.fasterxml.jackson.annotation.JsonInclude; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import com.fasterxml.jackson.core.JsonProcessingException; | ||
|
||
import org.opensearch.security.DefaultObjectMapper; | ||
|
@@ -125,11 +126,12 @@ public static class Dynamic { | |
public String hosts_resolver_mode = "ip-only"; | ||
public String transport_userrname_attribute; | ||
public boolean do_not_fail_on_forbidden_empty; | ||
public Extensions extensions = new Extensions(); | ||
|
||
@Override | ||
public String toString() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you update this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there a use case for allowing this part of the configuration to be printed? Since it stores encryption/signing keys I think it would be a good idea to hide it as much as possible. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's a good point, I'm checking to see if and where it is called. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So it's ok to include this secret strings in toString() methods. Pushed my changes |
||
return "Dynamic [filtered_alias_mode=" + filtered_alias_mode + ", kibana=" + kibana + ", http=" + http + ", authc=" + authc + ", authz=" | ||
+ authz + "]"; | ||
+ authz + ", extensions=" + extensions + "]"; | ||
} | ||
} | ||
|
||
|
@@ -461,8 +463,43 @@ public String toString() { | |
return "AuthzDomain [http_enabled=" + http_enabled + ", transport_enabled=" + transport_enabled | ||
+ ", authorization_backend=" + authorization_backend + ", description=" + description + "]"; | ||
} | ||
|
||
|
||
|
||
} | ||
|
||
public static class Extensions { | ||
@JsonProperty("signing_key") | ||
private String signingKey; | ||
@JsonProperty("encryption_key") | ||
private String encryptionKey; | ||
|
||
@JsonIgnore | ||
public String configAsJson() { | ||
try { | ||
return DefaultObjectMapper.writeValueAsString(this, false); | ||
} catch (JsonProcessingException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
public String getSigningKey() { | ||
return signingKey; | ||
} | ||
|
||
public void setSigningKey(String signingKey) { | ||
this.signingKey = signingKey; | ||
} | ||
|
||
public String getEncryptionKey() { | ||
return encryptionKey; | ||
} | ||
|
||
public void setEncryptionKey(String encryptionKey) { | ||
this.encryptionKey = encryptionKey; | ||
} | ||
|
||
@Override | ||
public String toString() { | ||
return "Extensions [signing_key=" + signingKey + ", encryption_key=" + encryptionKey +"]"; | ||
} | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! This is great that you were able to show the dynamic config settings being updated using the integration test framework. 🚀