Skip to content

Commit

Permalink
SHIBUI-2627
Browse files Browse the repository at this point in the history
Correcting the index issue on ACS items
  • Loading branch information
chasegawa committed Oct 31, 2023
1 parent beff030 commit 7090cec
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
9 changes: 6 additions & 3 deletions backend/src/test/resources/metadata/SHIBUI-2380.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,15 @@
<md:NameIDFormat>urn:mace:shibboleth:metadata:oidc:1.0:nameid-format:pairwise</md:NameIDFormat>
<md:AssertionConsumerService
Binding="https://tools.ietf.org/html/rfc6749#section-3.1.2"
Location="https://example.org/cb"/>
Location="https://example.org/cb"
index="0"/>
<md:AssertionConsumerService
Binding="https://tools.ietf.org/html/rfc6749#section-3.1.2"
Location="https://example.org/cb2"/>
Location="https://example.org/cb2"
index="1"/>
<md:AssertionConsumerService
Binding="http://example.org/not/supported/profile/id"
Location="https://example.org/cb3"/>
Location="https://example.org/cb3"
index="2"/>
</md:SPSSODescriptor>
</md:EntityDescriptor>

0 comments on commit 7090cec

Please sign in to comment.