[java-metadata-aggregator] branch main updated: MDA-303 - Remove SAMLMetadataSupport.addDescriptorExtension
Ian Young
ian at iay.org.uk
Thu Feb 8 18:08:39 UTC 2024
This is an automated email from the git hooks/post-receive script.
iay pushed a commit to branch main
in repository java-metadata-aggregator.
View the commit online:
http://git.shibboleth.net/view/?p=java-metadata-aggregator.git;a=commit;h=1b088be9005645161505788c5b7cbf5c5c292fc8
The following commit(s) were added to refs/heads/main by this push:
new 1b088be MDA-303 - Remove SAMLMetadataSupport.addDescriptorExtension
1b088be is described below
commit 1b088be9005645161505788c5b7cbf5c5c292fc8
Author: Ian Young <ian at iay.org.uk>
AuthorDate: Thu Feb 8 18:08:09 2024 +0000
MDA-303 - Remove SAMLMetadataSupport.addDescriptorExtension
https://shibboleth.atlassian.net/browse/MDA-303
---
.../metadata/dom/saml/SAMLMetadataSupport.java | 51 ----------------------
1 file changed, 51 deletions(-)
diff --git a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/SAMLMetadataSupport.java b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/SAMLMetadataSupport.java
index 8bc7a2d..eeaae8f 100644
--- a/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/SAMLMetadataSupport.java
+++ b/mda-framework/src/main/java/net/shibboleth/metadata/dom/saml/SAMLMetadataSupport.java
@@ -15,7 +15,6 @@
package net.shibboleth.metadata.dom.saml;
import java.util.List;
-import java.util.Map;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -24,7 +23,6 @@ import javax.xml.namespace.QName;
import org.w3c.dom.Element;
-import net.shibboleth.metadata.dom.ds.XMLDSIGSupport;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.xml.AttributeSupport;
import net.shibboleth.shared.xml.ElementSupport;
@@ -215,55 +213,6 @@ public final class SAMLMetadataSupport {
return results.get(0);
}
-
- /**
- * Adds a given extension to a given descriptor. If the given descriptor does not yet have an extensions element
- * then one is added, otherwise the given extension is added as after any existing extensions.
- *
- * @param descriptor descriptor to which the extension will be added
- * @param extension extension to be added to the descriptor
- */
- public static void addDescriptorExtension(@Nullable final Element descriptor, @Nullable final Element extension) {
- if (descriptor == null || extension == null) {
- return;
- }
-
- if (!isEntitiesDescriptor(descriptor) && !isEntityDescriptor(descriptor)) {
- return;
- }
-
- final @Nonnull Element extensionsElement;
-
- final Map<QName, List<Element>> descriptorChildren = ElementSupport.getIndexedChildElements(descriptor);
- final List<Element> extensionsElements = descriptorChildren.get(EXTENSIONS_NAME);
- if (extensionsElements.isEmpty()) {
- final var ownerDocument = descriptor.getOwnerDocument();
- assert ownerDocument != null;
- extensionsElement = ElementSupport.constructElement(ownerDocument, EXTENSIONS_NAME);
-
- Element insertExtensionsElementBefore = null;
- final List<Element> signatureElements = descriptorChildren.get(XMLDSIGSupport.SIGNATURE_NAME);
- if (!signatureElements.isEmpty()) {
- final Element lastSignatureElement = signatureElements.get(signatureElements.size() - 1);
- assert lastSignatureElement != null;
- insertExtensionsElementBefore = ElementSupport.getNextSiblingElement(lastSignatureElement);
- } else {
- insertExtensionsElementBefore = ElementSupport.getFirstChildElement(descriptor);
- }
-
- if (insertExtensionsElementBefore == null) {
- descriptor.appendChild(extensionsElement);
- } else {
- descriptor.insertBefore(extensionsElement, insertExtensionsElementBefore);
- }
- } else {
- final var exten = extensionsElements.get(0);
- assert exten != null;
- extensionsElement = exten;
- }
-
- ElementSupport.appendChildElement(extensionsElement, extension);
- }
/**
* Return the {@code entityID} attribute from an entity descriptor,
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list