Skip to content

Commit

Permalink
Fix potential NPE in migration script for KC 26 (keycloak#35794)
Browse files Browse the repository at this point in the history
Closes keycloak#35793

Signed-off-by: Sven-Torben Janus <sven-torben.janus@conciso.de>
(cherry picked from commit 7531f97)
  • Loading branch information
sventorben authored and jonkoops committed Dec 11, 2024
1 parent e96ffa1 commit d268ceb
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,15 @@ public void migrateImport(KeycloakSession session, RealmModel realm, RealmRepres

private void migrateRealm(KeycloakSession session, RealmModel realm) {
ClientModel adminConsoleClient = realm.getClientByClientId(Constants.ADMIN_CONSOLE_CLIENT_ID);
adminConsoleClient.setFullScopeAllowed(true);
adminConsoleClient.setAttribute(Constants.USE_LIGHTWEIGHT_ACCESS_TOKEN_ENABLED, String.valueOf(true));
if (adminConsoleClient != null) {
adminConsoleClient.setFullScopeAllowed(true);
adminConsoleClient.setAttribute(Constants.USE_LIGHTWEIGHT_ACCESS_TOKEN_ENABLED, String.valueOf(true));
}
ClientModel adminCliClient = realm.getClientByClientId(Constants.ADMIN_CLI_CLIENT_ID);
adminCliClient.setFullScopeAllowed(true);
adminCliClient.setAttribute(Constants.USE_LIGHTWEIGHT_ACCESS_TOKEN_ENABLED, String.valueOf(true));
if (adminCliClient != null) {
adminCliClient.setFullScopeAllowed(true);
adminCliClient.setAttribute(Constants.USE_LIGHTWEIGHT_ACCESS_TOKEN_ENABLED, String.valueOf(true));
}
}
}

0 comments on commit d268ceb

Please sign in to comment.