docs: public static AssertionConsumerService getAssertionConsumerServiceFor(final AuthnRequest authnRequest,
                                                                            final ServicesManager servicesManager,
                                                                            final SamlRegisteredServiceCachingMetadataResolver resolver) {
          try {
              val acs = new AssertionConsumerServiceBuilder().buildObject();
              if (authnRequest.getAssertionConsumerServiceIndex() != null) {
                  val issuer = getIssuerFromSamlRequest(authnRequest);
                  val samlResolver = getMetadataResolverForAllSamlServices(servicesManager, issuer, resolver);
                  val criteriaSet = new CriteriaSet();
                  criteriaSet.add(new EntityIdCriterion(issuer));
                  criteriaSet.add(new EntityRoleCriterion(SPSSODescriptor.DEFAULT_ELEMENT_NAME));
                  criteriaSet.add(new BindingCriterion(CollectionUtils.wrap(SAMLConstants.SAML2_POST_BINDING_URI)));
  
                  val it = samlResolver.resolve(criteriaSet);
                  it.forEach(entityDescriptor -> {
                      val spssoDescriptor = entityDescriptor.getSPSSODescriptor(SAMLConstants.SAML20P_NS);
                      val acsEndpoints = spssoDescriptor.getAssertionConsumerServices();
                      if (acsEndpoints.isEmpty()) {
                          throw new IllegalArgumentException("Metadata resolved for entity id " + issuer + " has no defined ACS endpoints");
                      }
                      val acsIndex = authnRequest.getAssertionConsumerServiceIndex();
                      if (acsIndex + 1 > acsEndpoints.size()) {
                          throw new IllegalArgumentException("AssertionConsumerService index specified in the request " + acsIndex + " is invalid "
                              + "since the total endpoints available to " + issuer + " is " + acsEndpoints.size());
                      }
                      val foundAcs = acsEndpoints.get(acsIndex);
                      acs.setBinding(foundAcs.getBinding());
                      acs.setLocation(foundAcs.getLocation());
                      acs.setResponseLocation(foundAcs.getResponseLocation());
                      acs.setIndex(acsIndex);
                  });
              } else {
                  acs.setBinding(authnRequest.getProtocolBinding());
                  acs.setLocation(authnRequest.getAssertionConsumerServiceURL());
                  acs.setResponseLocation(authnRequest.getAssertionConsumerServiceURL());
                  acs.setIndex(0);
                  acs.setIsDefault(Boolean.TRUE);
              }
  
              LOGGER.debug("Resolved AssertionConsumerService from the request is [{}]", acs);
              if (StringUtils.isBlank(acs.getBinding())) {
                  throw new SamlException("AssertionConsumerService has no protocol binding defined");
              }
              if (StringUtils.isBlank(acs.getLocation()) && StringUtils.isBlank(acs.getResponseLocation())) {
                  throw new SamlException("AssertionConsumerService has no location or response location defined");
              }
              return acs;
          } catch (final Exception e) {
              throw new IllegalArgumentException(new SamlException(e.getMessage(), e));
          }
      }