From 7090cec2e60285c7fea46a6a305bb317bba7b14a Mon Sep 17 00:00:00 2001 From: chasegawa Date: Tue, 31 Oct 2023 14:28:02 -0700 Subject: [PATCH] SHIBUI-2627 Correcting the index issue on ACS items --- .../admin/util/EntityDescriptorConversionUtils.java | 7 ++++--- backend/src/test/resources/metadata/SHIBUI-2380.xml | 9 ++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) 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