Skip to content

Commit

Permalink
fix: backport
Browse files Browse the repository at this point in the history
  • Loading branch information
sattvikc committed Mar 21, 2024
1 parent 6f8038c commit b1e0ce5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [1.25.2] - 2024-03-21

- Adds a new `useStaticKey` param to `updateSessionInfo_Transaction`
- This enables smooth switching between `useDynamicAccessTokenSigningKey` settings by allowing refresh calls to
change the signing key type of a session

## [1.25.1]

- Fixes issue where error logs were printed to StdOut instead of StdErr.
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ plugins {
id 'java-library'
}

version = "1.25.1"
version = "1.25.2"

repositories {
mavenCentral()
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/supertokens/storage/mongodb/Queries.java
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ static SessionInfoWithLastUpdated getSessionInfo_Transaction(Start start, String
}

static boolean updateSessionInfo_Transaction(Start start, String sessionHandle, String refreshTokenHash2,
long expiry, String lastUpdatedSign) throws StorageQueryException {
long expiry, String lastUpdatedSign, boolean useStaticKey) throws StorageQueryException {

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

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

UpdateResult result = collection.updateOne(
Filters.and(Filters.eq("_id", sessionHandle), Filters.eq("last_updated_sign", lastUpdatedSign)),
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/supertokens/storage/mongodb/Start.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,10 @@ public int getNumberOfSessions(TenantIdentifier tenantIdentifier) throws Storage

@Override
public boolean updateSessionInfo_Transaction(String sessionHandle, String refreshTokenHash2, long expiry,
String lastUpdatedSign) throws StorageQueryException {
String lastUpdatedSign, boolean useStaticKey) throws StorageQueryException {
try {
return Queries.updateSessionInfo_Transaction(this, sessionHandle, refreshTokenHash2, expiry,
lastUpdatedSign);
lastUpdatedSign, useStaticKey);
} catch (MongoException e) {
throw new StorageQueryException(e);
}
Expand Down

0 comments on commit b1e0ce5

Please sign in to comment.