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>() {
|
Collections.sort(authenticationFlows, new Comparator<AuthenticationFlowModel>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(AuthenticationFlowModel left, AuthenticationFlowModel right) {
|
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>() {
|
Collections.sort(authenticatorConfigs, new Comparator<AuthenticatorConfigModel>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(AuthenticatorConfigModel left, AuthenticatorConfigModel right) {
|
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>() {
|
Collections.sort(requiredActionProviders, new Comparator<RequiredActionProviderModel>() {
|
||||||
@Override
|
@Override
|
||||||
public int compare(RequiredActionProviderModel left, RequiredActionProviderModel right) {
|
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);
|
AuthenticatorConfigModel config = RepresentationToModel.toModel(json);
|
||||||
|
if (config.getAlias() == null) {
|
||||||
|
return ErrorResponse.error("Alias missing", Response.Status.BAD_REQUEST);
|
||||||
|
}
|
||||||
config = realm.addAuthenticatorConfig(config);
|
config = realm.addAuthenticatorConfig(config);
|
||||||
model.setAuthenticatorConfig(config.getId());
|
model.setAuthenticatorConfig(config.getId());
|
||||||
realm.updateAuthenticatorExecution(model);
|
realm.updateAuthenticatorExecution(model);
|
||||||
|
|
Loading…
Reference in a new issue