Skip to content

Commit 203eb0b

Browse files
merged in new changes from main
2 parents f843c0e + a9bfb1f commit 203eb0b

File tree

7 files changed

+193
-194
lines changed

7 files changed

+193
-194
lines changed

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
<groupId>com.uid2</groupId>
77
<artifactId>uid2-shared</artifactId>
8-
<version>10.8.6</version>
8+
<version>10.9.4</version>
99
<name>${project.groupId}:${project.artifactId}</name>
1010
<description>Library for all the shared uid2 operations</description>
1111
<url>https://github.com/IABTechLab/uid2docs</url>
@@ -60,7 +60,7 @@
6060

6161
<properties>
6262
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
63-
<vertx.version>4.5.13</vertx.version>
63+
<vertx.version>4.5.18</vertx.version>
6464
<!-- check micrometer.version vertx-micrometer-metrics consumes before bumping up -->
6565
<micrometer.version>1.12.2</micrometer.version>
6666
<image.version>${project.version}</image.version>

src/main/java/com/uid2/shared/auth/Role.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ public enum Role {
2626
SECRET_ROTATION, // corresponds to custom okta scope 'uid2.admin.secret-rotation'
2727
PRIVATE_OPERATOR_SYNC, // corresponds to custom okta scope 'uid2.admin.site-sync'
2828
METRICS_EXPORT, // corresponds to custom okta scope 'uid2.admin.metrics-export'
29+
ENCLAVE_REGISTRAR, // corresponds to custom okta scope 'uid2.admin.enclave-registrar'
2930
@JsonEnumDefaultValue
3031
UNKNOWN
3132
}

src/main/java/com/uid2/shared/store/salt/SaltFileParser.java

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,28 +27,24 @@ public SaltEntry[] parseFileLines(String[] saltFileLines, Integer size) {
2727

2828
private SaltEntry parseLine(String line, int lineNumber) {
2929
try {
30-
final String[] fields = line.split(",");
31-
30+
final String[] fields = line.split(",", -1);
3231
final long id = Integer.parseInt(fields[0]);
3332
final String hashedId = this.idHashingScheme.encode(id);
3433
final long lastUpdated = Long.parseLong(fields[1]);
35-
final String salt = fields[2].isEmpty() ? null : fields[2];
36-
final Long refreshFrom = Long.parseLong(fields[3]);
34+
final String salt = trimToNull(fields[2]);
35+
final long refreshFrom = Long.parseLong(fields[3]);
36+
final String previousSalt = trimToNull(fields[4]);
3737

38-
String previousSalt = null;
38+
// TODO: The fields below should stop being optional once refreshable UIDs features get rolled out in production. We can remove them one by one as necessary.
39+
// AU, 2025/07/28
3940
SaltEntry.KeyMaterial currentKeySalt = null;
4041
SaltEntry.KeyMaterial previousKeySalt = null;
41-
42-
if (fields.length > 4) {
43-
previousSalt = fields[4].isEmpty() ? null : fields[4];
42+
if (trimToNull(fields[5]) != null && trimToNull(fields[6]) != null) {
43+
currentKeySalt = new SaltEntry.KeyMaterial(Integer.parseInt(fields[5]), fields[6], fields[7]);
4444
}
4545

46-
if (fields.length > 7) {
47-
currentKeySalt = fields[5].isEmpty() ? null : new SaltEntry.KeyMaterial(Integer.parseInt(fields[5]), fields[6], fields[7]);
48-
}
49-
50-
if (fields.length > 10) {
51-
previousKeySalt = fields[8].isEmpty() ? null : new SaltEntry.KeyMaterial(Integer.parseInt(fields[8]), fields[9], fields[10]);
46+
if (trimToNull(fields[8]) != null && trimToNull(fields[9]) != null) {
47+
previousKeySalt = new SaltEntry.KeyMaterial(Integer.parseInt(fields[8]), fields[9], fields[10]);
5248
}
5349

5450
return new SaltEntry(id, hashedId, lastUpdated, salt, refreshFrom, previousSalt, currentKeySalt, previousKeySalt);
@@ -57,4 +53,7 @@ private SaltEntry parseLine(String line, int lineNumber) {
5753
}
5854
}
5955

56+
private String trimToNull(String s) {
57+
return s == null || s.isBlank() ? null : s.trim();
58+
}
6059
}

0 commit comments

Comments
 (0)