Skip to content

Commit

Permalink
Migration of sessions in KC25 should run only on migration, not on im…
Browse files Browse the repository at this point in the history
…ports

Closes keycloak#30351

Signed-off-by: Alexander Schwartz <[email protected]>
  • Loading branch information
ahus1 committed Jun 12, 2024
1 parent 8eda167 commit a161827
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ public ModelVersion getVersion() {

@Override
public void migrate(KeycloakSession session) {
// Can be null during store model tests.
if (session.sessions() != null) {
// Offer a migration for persistent user sessions which was added in KC25.
session.sessions().migrate(VERSION.toString());
}

session.realms().getRealmsStream().forEach(realm -> migrateRealm(session, realm));
}

Expand All @@ -66,8 +72,6 @@ protected void migrateRealm(KeycloakSession session, RealmModel realm) {
LOG.warnf("Client scope '%s' already exists in the realm '%s'. Please migrate this realm manually if you need basic claims in your tokens.", basicScope.getName(), realm.getName());
}

// offer a migration for persistent user sessions which was added in KC25
session.sessions().migrate(VERSION.toString());
}
}

0 comments on commit a161827

Please sign in to comment.