private static AssertionConsumerService buildAssertionConsumerServiceElement(
            SamlAssertionConsumerConfig config, SamlPortConfig portConfig, String hostname, int index) {
        final AssertionConsumerService consumer = build(AssertionConsumerService.DEFAULT_ELEMENT_NAME);

        consumer.setLocation(config.endpoint().toUriString(portConfig.scheme().uriText(),
                                                           hostname,
                                                           portConfig.port()));
        consumer.setBinding(config.endpoint().bindingProtocol().urn());
        consumer.setIndex(index);

        // Add 'isDefault' attribute only when told so.
        if (config.isDefault()) {
            consumer.setIsDefault(true);
        }
        return consumer;
    }
A service which returns the SAML metadata in response to a user request.
saml/src/main/java/com/linecorp/armeria/server/saml/SamlMetadataServiceFunction.java