KEYCLOAK-18359 Default role migration is not performed correctly when empty realm id
This commit is contained in:
parent
74089a51b3
commit
e3c76035b2
2 changed files with 3 additions and 10 deletions
|
@ -84,13 +84,7 @@ public class JpaUpdate13_0_0_MigrateDefaultRoles extends CustomKeycloakTask {
|
|||
ResultSet rs = statement.executeQuery()) {
|
||||
|
||||
while (rs.next()) {
|
||||
String realmId = rs.getString(1);
|
||||
|
||||
if (realmId == null || realmId.trim().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
realmIds.add(realmId);
|
||||
realmIds.add(rs.getString(1));
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
|
|
|
@ -501,10 +501,9 @@ public class RealmManager {
|
|||
*/
|
||||
public RealmModel importRealm(RealmRepresentation rep, boolean skipUserDependent) {
|
||||
String id = rep.getId();
|
||||
if (id == null) {
|
||||
if (id == null || id.trim().isEmpty()) {
|
||||
id = KeycloakModelUtils.generateId();
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
ReservedCharValidator.validate(id);
|
||||
}
|
||||
RealmModel realm = model.createRealm(id, rep.getRealm());
|
||||
|
|
Loading…
Reference in a new issue