Skip to content
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

fix: backport to core 6.0 #41

Merged
merged 1 commit into from
Mar 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.24.2] - 2024-03-29

- 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.24.1] - 2024-02-27

- Fixes vulnerabilities in dependencies
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.24.1"
version = "1.24.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
Loading