diff --git a/backend/src/main/java/edu/internet2/tier/shibboleth/admin/util/EntityDescriptorConversionUtils.java b/backend/src/main/java/edu/internet2/tier/shibboleth/admin/util/EntityDescriptorConversionUtils.java
index c9386399b..8a45d15d1 100644
--- a/backend/src/main/java/edu/internet2/tier/shibboleth/admin/util/EntityDescriptorConversionUtils.java
+++ b/backend/src/main/java/edu/internet2/tier/shibboleth/admin/util/EntityDescriptorConversionUtils.java
@@ -207,15 +207,16 @@ public static void setupACSs(EntityDescriptor ed, EntityDescriptorRepresentation
if (representation.getAssertionConsumerServices() != null && representation.getAssertionConsumerServices().size() > 0) {
// TODO: review if we need more than a naive implementation
ed.getOptionalSPSSODescriptor().ifPresent(spssoDescriptor -> spssoDescriptor.getAssertionConsumerServices().clear());
+ int indexPosition = 0;
for (AssertionConsumerServiceRepresentation acsRepresentation : representation.getAssertionConsumerServices()) {
AssertionConsumerService assertionConsumerService = openSamlObjects.buildDefaultInstanceOfType(AssertionConsumerService.class);
getSPSSODescriptorFromEntityDescriptor(ed).getAssertionConsumerServices().add(assertionConsumerService);
+ assertionConsumerService.setBinding(acsRepresentation.getBinding());
+ assertionConsumerService.setLocation(acsRepresentation.getLocationUrl());
if (acsRepresentation.isMakeDefault()) {
assertionConsumerService.setIsDefault(true);
}
- assertionConsumerService.setBinding(acsRepresentation.getBinding());
- assertionConsumerService.setLocation(acsRepresentation.getLocationUrl());
- assertionConsumerService.setIndex(acsRepresentation.getIndex());
+ assertionConsumerService.setIndex(acsRepresentation.getIndex() == null ? indexPosition++ : acsRepresentation.getIndex());
}
} else {
ed.getOptionalSPSSODescriptor().ifPresent(spssoDescriptor -> spssoDescriptor.getAssertionConsumerServices().clear());
diff --git a/backend/src/test/resources/metadata/SHIBUI-2380.xml b/backend/src/test/resources/metadata/SHIBUI-2380.xml
index 7ac4ac393..aa6f462e6 100644
--- a/backend/src/test/resources/metadata/SHIBUI-2380.xml
+++ b/backend/src/test/resources/metadata/SHIBUI-2380.xml
@@ -67,12 +67,15 @@
urn:mace:shibboleth:metadata:oidc:1.0:nameid-format:pairwise
+ Location="https://example.org/cb"
+ index="0"/>
+ Location="https://example.org/cb2"
+ index="1"/>
+ Location="https://example.org/cb3"
+ index="2"/>
\ No newline at end of file