KEYCLOAK-4920 NPE when exporting configuration without alias
This commit is contained in:
parent
5f43a6a342
commit
c5d9301951
2 changed files with 12 additions and 3 deletions
|
@ -356,7 +356,9 @@ public class ModelToRepresentation {
|
|||
Collections.sort(authenticationFlows, new Comparator<AuthenticationFlowModel>() {
|
||||
@Override
|
||||
public int compare(AuthenticationFlowModel left, AuthenticationFlowModel right) {
|
||||
return left.getAlias().compareTo(right.getAlias());
|
||||
String l = left.getAlias() != null ? left.getAlias() : "\0";
|
||||
String r = right.getAlias() != null ? right.getAlias() : "\0";
|
||||
return l.compareTo(r);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -370,7 +372,9 @@ public class ModelToRepresentation {
|
|||
Collections.sort(authenticatorConfigs, new Comparator<AuthenticatorConfigModel>() {
|
||||
@Override
|
||||
public int compare(AuthenticatorConfigModel left, AuthenticatorConfigModel right) {
|
||||
return left.getAlias().compareTo(right.getAlias());
|
||||
String l = left.getAlias() != null ? left.getAlias() : "\0";
|
||||
String r = right.getAlias() != null ? right.getAlias() : "\0";
|
||||
return l.compareTo(r);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -392,7 +396,9 @@ public class ModelToRepresentation {
|
|||
Collections.sort(requiredActionProviders, new Comparator<RequiredActionProviderModel>() {
|
||||
@Override
|
||||
public int compare(RequiredActionProviderModel left, RequiredActionProviderModel right) {
|
||||
return left.getAlias().compareTo(right.getAlias());
|
||||
String l = left.getAlias() != null ? left.getAlias() : "\0";
|
||||
String r = right.getAlias() != null ? right.getAlias() : "\0";
|
||||
return l.compareTo(r);
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -735,6 +735,9 @@ public class AuthenticationManagementResource {
|
|||
|
||||
}
|
||||
AuthenticatorConfigModel config = RepresentationToModel.toModel(json);
|
||||
if (config.getAlias() == null) {
|
||||
return ErrorResponse.error("Alias missing", Response.Status.BAD_REQUEST);
|
||||
}
|
||||
config = realm.addAuthenticatorConfig(config);
|
||||
model.setAuthenticatorConfig(config.getId());
|
||||
realm.updateAuthenticatorExecution(model);
|
||||
|
|
Loading…
Reference in a new issue