NPE when Default Role is not present on CachedRealm
closes: #33817 Signed-off-by: Pedro Hos <pedro-hos@outlook.com>
This commit is contained in:
parent
94b5f05c64
commit
91026d6713
1 changed files with 7 additions and 1 deletions
|
@ -22,6 +22,7 @@ import java.util.HashMap;
|
|||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Supplier;
|
||||
|
@ -39,6 +40,7 @@ import org.keycloak.models.CibaConfig;
|
|||
import org.keycloak.models.ClientModel;
|
||||
import org.keycloak.models.ClientScopeModel;
|
||||
import org.keycloak.models.GroupModel;
|
||||
import org.keycloak.models.ModelException;
|
||||
import org.keycloak.models.OAuth2DeviceConfig;
|
||||
import org.keycloak.models.OTPPolicy;
|
||||
import org.keycloak.models.ParConfig;
|
||||
|
@ -249,7 +251,11 @@ public class CachedRealm extends AbstractExtendableRevisioned {
|
|||
adminEventsEnabled = model.isAdminEventsEnabled();
|
||||
adminEventsDetailsEnabled = model.isAdminEventsDetailsEnabled();
|
||||
|
||||
defaultRoleId = model.getDefaultRole().getId();
|
||||
if(Objects.isNull(model.getDefaultRole())) {
|
||||
throw new ModelException("Default Role is null for Realm " + name);
|
||||
} else {
|
||||
defaultRoleId = model.getDefaultRole().getId();
|
||||
}
|
||||
ClientModel masterAdminClient = model.getMasterAdminClient();
|
||||
this.masterAdminClient = (masterAdminClient != null) ? masterAdminClient.getId() : null;
|
||||
|
||||
|
|
Loading…
Reference in a new issue