Skip to content

Commit adb8269

Browse files
committed
fix: backport to core 6.0
1 parent 2044dd1 commit adb8269

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
99

10+
## [1.24.2] - 2024-03-29
11+
12+
- Adds a new `useStaticKey` param to `updateSessionInfo_Transaction`
13+
- This enables smooth switching between `useDynamicAccessTokenSigningKey` settings by allowing refresh calls to
14+
change the signing key type of a session
15+
1016
## [1.24.1] - 2024-02-27
1117

1218
- Fixes vulnerabilities in dependencies

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ plugins {
22
id 'java-library'
33
}
44

5-
version = "1.24.1"
5+
version = "1.24.2"
66

77
repositories {
88
mavenCentral()

src/main/java/io/supertokens/storage/mongodb/Queries.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ static SessionInfoWithLastUpdated getSessionInfo_Transaction(Start start, String
264264
}
265265

266266
static boolean updateSessionInfo_Transaction(Start start, String sessionHandle, String refreshTokenHash2,
267-
long expiry, String lastUpdatedSign) throws StorageQueryException {
267+
long expiry, String lastUpdatedSign, boolean useStaticKey) throws StorageQueryException {
268268

269269
if (lastUpdatedSign == null) {
270270
throw new StorageQueryException(new Exception("lastUpdatedSign cannot be null for this update operation"));
@@ -274,7 +274,7 @@ static boolean updateSessionInfo_Transaction(Start start, String sessionHandle,
274274
MongoCollection collection = client.getCollection(Config.getConfig(start).getSessionInfoCollection());
275275

276276
Document toUpdate = new Document("$set", new Document("refresh_token_hash_2", refreshTokenHash2)
277-
.append("expires_at", expiry).append("last_updated_sign", Utils.getUUID()));
277+
.append("expires_at", expiry).append("last_updated_sign", Utils.getUUID()).append("use_static_key", useStaticKey));
278278

279279
UpdateResult result = collection.updateOne(
280280
Filters.and(Filters.eq("_id", sessionHandle), Filters.eq("last_updated_sign", lastUpdatedSign)),

src/main/java/io/supertokens/storage/mongodb/Start.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,10 @@ public int getNumberOfSessions(TenantIdentifier tenantIdentifier) throws Storage
139139

140140
@Override
141141
public boolean updateSessionInfo_Transaction(String sessionHandle, String refreshTokenHash2, long expiry,
142-
String lastUpdatedSign) throws StorageQueryException {
142+
String lastUpdatedSign, boolean useStaticKey) throws StorageQueryException {
143143
try {
144144
return Queries.updateSessionInfo_Transaction(this, sessionHandle, refreshTokenHash2, expiry,
145-
lastUpdatedSign);
145+
lastUpdatedSign, useStaticKey);
146146
} catch (MongoException e) {
147147
throw new StorageQueryException(e);
148148
}

0 commit comments

Comments
 (0)