Skip to content

Commit fa76c2b

Browse files
authored
fix: protected config fix (#107)
* fix: protected config fix * fix: version update * fix: version update
1 parent c9bd517 commit fa76c2b

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
99

10+
## [3.0.1] - 2023-07-04
11+
12+
- Updates `TenantConfig` toJson function to protect core config as well.
13+
1014
## [3.0.0] - 2023-06-02
1115

1216
- Adds support for multi-tenancy

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ plugins {
22
id 'java-library'
33
}
44

5-
version = "3.0.0"
5+
version = "3.0.1"
66

77
repositories {
88
mavenCentral()

src/main/java/io/supertokens/pluginInterface/multitenancy/TenantConfig.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public int hashCode() {
8989
return tenantIdentifier.hashCode();
9090
}
9191

92-
public JsonObject toJson(boolean shouldProtectDbConfig, Storage storage) {
92+
public JsonObject toJson(boolean shouldProtectDbConfig, Storage storage, String[] protectedCoreConfigs) {
9393
Gson gson = new Gson();
9494
JsonObject tenantConfigObject = gson.toJsonTree(this).getAsJsonObject();
9595
tenantConfigObject.addProperty("tenantId", this.tenantIdentifier.getTenantId());
@@ -101,6 +101,12 @@ public JsonObject toJson(boolean shouldProtectDbConfig, Storage storage) {
101101
tenantConfigObject.get("coreConfig").getAsJsonObject().remove(config);
102102
}
103103
}
104+
105+
for (String config : protectedCoreConfigs) {
106+
if (tenantConfigObject.get("coreConfig").getAsJsonObject().has(config)) {
107+
tenantConfigObject.get("coreConfig").getAsJsonObject().remove(config);
108+
}
109+
}
104110
}
105111

106112
return tenantConfigObject;

0 commit comments

Comments
 (0)