[java-idp-plugin-metadatagen] branch dev/JMETAGEN-5 updated: Strip out extraneous code.

Scott Cantor cantor.2 at osu.edu
Thu Jul 13 15:14:43 UTC 2023


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch dev/JMETAGEN-5
in repository java-idp-plugin-metadatagen.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-metadatagen.git;a=commit;h=03b4eab7135911a263c58cb39830523e3f555b24

The following commit(s) were added to refs/heads/dev/JMETAGEN-5 by this push:
     new 03b4eab  Strip out extraneous code.
03b4eab is described below

commit 03b4eab7135911a263c58cb39830523e3f555b24
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Jul 13 11:14:40 2023 -0400

    Strip out extraneous code.
---
 .../plugin/metadatagen/impl/MetadataGenCLI.java    | 303 +--------------------
 1 file changed, 1 insertion(+), 302 deletions(-)

diff --git a/metadatagen-impl/src/main/java/net/shibboleth/idp/plugin/metadatagen/impl/MetadataGenCLI.java b/metadatagen-impl/src/main/java/net/shibboleth/idp/plugin/metadatagen/impl/MetadataGenCLI.java
index 729df48..e765b0d 100644
--- a/metadatagen-impl/src/main/java/net/shibboleth/idp/plugin/metadatagen/impl/MetadataGenCLI.java
+++ b/metadatagen-impl/src/main/java/net/shibboleth/idp/plugin/metadatagen/impl/MetadataGenCLI.java
@@ -21,16 +21,9 @@ import java.io.BufferedOutputStream;
 import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
-import java.io.OutputStream;
 import java.io.PrintWriter;
 import java.io.Writer;
-import java.time.Instant;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.HashMap;
 import java.util.List;
-import java.util.Map;
 import java.util.stream.Collectors;
 import java.util.stream.Stream;
 
@@ -38,52 +31,22 @@ import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
 import org.apache.velocity.app.VelocityEngine;
-import org.opensaml.core.xml.LangBearing;
 import org.opensaml.saml.common.xml.SAMLConstants;
-import org.opensaml.saml.ext.reqattr.RequestedAttributes;
-import org.opensaml.saml.ext.saml2mdui.Description;
-import org.opensaml.saml.ext.saml2mdui.DisplayName;
-import org.opensaml.saml.ext.saml2mdui.Logo;
-import org.opensaml.saml.ext.saml2mdui.UIInfo;
 import org.opensaml.saml.metadata.generator.impl.AbstractEndpointConverter;
 import org.opensaml.saml.metadata.generator.impl.VelocityMetadataGenerator;
-import org.opensaml.saml.saml2.core.Extensions;
-import org.opensaml.saml.saml2.metadata.ArtifactResolutionService;
-import org.opensaml.saml.saml2.metadata.AssertionConsumerService;
-import org.opensaml.saml.saml2.metadata.AttributeAuthorityDescriptor;
-import org.opensaml.saml.saml2.metadata.AttributeService;
-import org.opensaml.saml.saml2.metadata.EntityDescriptor;
-import org.opensaml.saml.saml2.metadata.IDPSSODescriptor;
-import org.opensaml.saml.saml2.metadata.KeyDescriptor;
-import org.opensaml.saml.saml2.metadata.SPSSODescriptor;
-import org.opensaml.saml.saml2.metadata.SingleLogoutService;
-import org.opensaml.saml.saml2.metadata.SingleSignOnService;
-import org.opensaml.security.x509.X509Support;
-import org.opensaml.xmlsec.signature.KeyInfo;
-import org.opensaml.xmlsec.signature.X509Data;
-import org.opensaml.xmlsec.signature.support.SignatureConstants;
+
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeansException;
-import org.springframework.beans.factory.NoSuchBeanDefinitionException;
-import org.springframework.core.env.Environment;
 import org.springframework.core.io.ClassPathResource;
 import org.springframework.core.io.Resource;
 
 import net.shibboleth.idp.cli.AbstractIdPHomeAwareCommandLine;
-import net.shibboleth.idp.saml.xmlobject.ExtensionsConstants;
-import net.shibboleth.idp.saml.xmlobject.Scope;
 import net.shibboleth.shared.annotation.constraint.NotEmpty;
 import net.shibboleth.shared.annotation.constraint.NotLive;
 import net.shibboleth.shared.annotation.constraint.Unmodifiable;
 import net.shibboleth.shared.cli.AbstractCommandLine;
-import net.shibboleth.shared.codec.Base64Support;
-import net.shibboleth.shared.codec.EncodingException;
 import net.shibboleth.shared.collection.CollectionSupport;
-import net.shibboleth.shared.primitive.StringSupport;
-import net.shibboleth.shared.velocity.Template;
-import net.shibboleth.shared.xml.DOMTypeSupport;
-import net.shibboleth.shared.xml.XMLConstants;
 
 /**
  * Command Line to generate SAML metadata.
@@ -124,270 +87,6 @@ public final class MetadataGenCLI extends AbstractIdPHomeAwareCommandLine<Metada
     @Nonnull protected String getVersion() {
         return getClass().getPackage().getImplementationVersion();
     }
-
-//    /** Output Scope and MDUI.
-//     * @param includeMDUI do we output the MDUI
-//     */
-//    private void outputExtensions(final boolean includeMDUI) {
-//        final Environment env = getApplicationContext().getEnvironment();
-//        final String scope = StringSupport.trimOrNull(env.getProperty("idp.scope"));
-//        if (!includeMDUI && scope == null) {
-//                return;
-//        }
-//        output.format("        <%s>\n", Extensions.DEFAULT_ELEMENT_LOCAL_NAME);
-//        if (scope != null) {
-//            output.format("          <%s:%s regexp=\"false\">%s</%s:%s>\n",
-//                    ExtensionsConstants.SHIB_MDEXT10_PREFIX, Scope.DEFAULT_ELEMENT_LOCAL_NAME,
-//                    scope,
-//                    ExtensionsConstants.SHIB_MDEXT10_PREFIX, Scope.DEFAULT_ELEMENT_LOCAL_NAME);
-//        }
-//
-//        if (includeMDUI) {
-//            output.format("          <%s:%s>\n",
-//                    SAMLConstants.SAML20MDUI_PREFIX, UIInfo.DEFAULT_ELEMENT_LOCAL_NAME);
-//            final String mduiLangs = env.getProperty(MetadataGenCommandLineArguments.MDUI_LANGS_PROPERTY);
-//            if (mduiLangs == null) {
-//                output.format("\n<!--\n          Fill in the details for your IdP here\n\n");
-//                output.format("            <%s:%s %s:%s=\"en\">A Name for the IdP</%s:%s>\n",
-//                        SAMLConstants.SAML20MDUI_PREFIX, DisplayName.DEFAULT_ELEMENT_LOCAL_NAME,
-//                        XMLConstants.XML_PREFIX, LangBearing.XML_LANG_ATTR_LOCAL_NAME,
-//                        SAMLConstants.SAML20MDUI_PREFIX, DisplayName.DEFAULT_ELEMENT_LOCAL_NAME);
-//                output.format("            <%s:%s %s:%s=\"en\">A Description for the IdP</%s:%s>\n",
-//                        SAMLConstants.SAML20MDUI_PREFIX, Description.DEFAULT_ELEMENT_LOCAL_NAME,
-//                        XMLConstants.XML_PREFIX, LangBearing.XML_LANG_ATTR_LOCAL_NAME,
-//                        SAMLConstants.SAML20MDUI_PREFIX, Description.DEFAULT_ELEMENT_LOCAL_NAME);
-//            } else {
-//                for (final String lang:mduiLangs.split(" ")) {
-//                    outputMDUI(lang);
-//                }
-//            }
-//            final String logoY = env.getProperty(MetadataGenCommandLineArguments.MDUI_LOGO_HEIGHT, "80");
-//            final String logoX = env.getProperty(MetadataGenCommandLineArguments.MDUI_LOGO_WIDTH, "80");
-//            final String logoPath = env.getProperty(MetadataGenCommandLineArguments.MDUI_LOGO_PATH, "/path/to/logo");
-//            output.format("            <%s:%s height=\"%s\" width=\"%s\">https://%s%s</%s:%s>\n",
-//                    SAMLConstants.SAML20MDUI_PREFIX, Logo.DEFAULT_ELEMENT_LOCAL_NAME,
-//                    logoY, logoX,  getDnsName(), logoPath,
-//                    SAMLConstants.SAML20MDUI_PREFIX, Logo.DEFAULT_ELEMENT_LOCAL_NAME);
-//            if (mduiLangs == null) {
-//                output.format("-->\n\n");
-//            }
-//            output.format("          </%s:%s>\n", SAMLConstants.SAML20MDUI_PREFIX, UIInfo.DEFAULT_ELEMENT_LOCAL_NAME);
-//        }
-//        output.format("\n        </%s>\n\n", Extensions.DEFAULT_ELEMENT_LOCAL_NAME);
-//    }
-//
-//    /** Output Logout end points. */
-//    private void outputLogoutEndpoints() {
-//        output.format("        <%s Binding=\"%s\""
-//                + " Location=\"https://%s/idp/profile/SAML2/Redirect/SLO\"/>\n",
-//                SingleLogoutService.DEFAULT_ELEMENT_LOCAL_NAME,
-//                SAMLConstants.SAML2_REDIRECT_BINDING_URI,
-//                getDnsName());
-//        output.format("        <%s Binding=\"%s\""
-//                + " Location=\"https://%s/idp/profile/SAML2/POST/SLO\"/>\n",
-//                SingleLogoutService.DEFAULT_ELEMENT_LOCAL_NAME,
-//                SAMLConstants.SAML2_POST_BINDING_URI,
-//                getDnsName());
-//        output.format("        <%s Binding=\"%s\""
-//                + " Location=\"https://%s/idp/profile/SAML2/POST/SLO-SimpleSign\"/>\n",
-//                SingleLogoutService.DEFAULT_ELEMENT_LOCAL_NAME,
-//                SAMLConstants.SAML2_POST_SIMPLE_SIGN_BINDING_URI,
-//                getDnsName());
-//
-//        final List<String> backCert = parameters.getBackchannelCert();
-//        if (backCert != null && !backCert.isEmpty()) {
-//            output.format("        <%s Binding=\"%s\""
-//                    + " Location=\"https://%s:8443/idp/profile/SAML2/SOAP/SLO\"/>\n",
-//                    SingleLogoutService.DEFAULT_ELEMENT_LOCAL_NAME,
-//                    SAMLConstants.SAML2_SOAP11_BINDING_URI,
-//                    getDnsName());
-//        }
-//    }
-//
-//    /** Output Artifact Endpoints. */
-//    private void outputArtifactEndpoints() {
-//        if (args.isSaml1()) {
-//            output.format("        <%s Binding=\"%s\""
-//                    + " Location=\"https://%s:8443/idp/profile/SAML1/SOAP/ArtifactResolution\" index=\"1\"/>\n",
-//                    ArtifactResolutionService.DEFAULT_ELEMENT_LOCAL_NAME,
-//                    SAMLConstants.SAML1_SOAP11_BINDING_URI,
-//                    getDnsName());
-//        }
-//        output.format("        <%s Binding=\"%s\""
-//                + " Location=\"https://%s:8443/idp/profile/SAML2/SOAP/ArtifactResolution\" index=\"2\"/>\n",
-//                ArtifactResolutionService.DEFAULT_ELEMENT_LOCAL_NAME,
-//                SAMLConstants.SAML2_SOAP11_BINDING_URI,
-//                getDnsName());
-//    }
-//
-//    /** Output SSO Endpoints. */
-//    private void outputSSOEndpoints() {
-//        if (args.isSaml1()) {
-//            output.format("        <%s Binding=\"%s\""
-//                    + " Location=\"https://%s/idp/profile/Shibboleth/SSO\"/>\n",
-//                    SingleSignOnService.DEFAULT_ELEMENT_LOCAL_NAME,
-//                    "urn:mace:shibboleth:1.0:profiles:AuthnRequest",
-//                    getDnsName());
-//
-//        }
-//        output.format("        <%s Binding=\"%s\""
-//                + " %s:%s=\"true\""
-//                + " Location=\"https://%s/idp/profile/SAML2/POST/SSO\"/>\n",
-//                SingleSignOnService.DEFAULT_ELEMENT_LOCAL_NAME,
-//                SAMLConstants.SAML2_POST_BINDING_URI,
-//                SAMLConstants.SAML20PREQ_ATTRR_PREFIX, RequestedAttributes.SUPPORTS_REQUESTED_ATTRIBUTES_LOCAL_NAME,
-//                getDnsName());
-//        output.format("        <%s Binding=\"%s\""
-//                + " %s:%s=\"true\""
-//                + " Location=\"https://%s/idp/profile/SAML2/POST-SimpleSign/SSO\"/>\n",
-//                SingleSignOnService.DEFAULT_ELEMENT_LOCAL_NAME,
-//                SAMLConstants.SAML2_POST_SIMPLE_SIGN_BINDING_URI,
-//                SAMLConstants.SAML20PREQ_ATTRR_PREFIX, RequestedAttributes.SUPPORTS_REQUESTED_ATTRIBUTES_LOCAL_NAME,
-//                getDnsName());
-//        output.format("        <%s Binding=\"%s\""
-//                + " %s:%s=\"true\""
-//                + " Location=\"https://%s/idp/profile/SAML2/Redirect/SSO\"/>\n",
-//                SingleSignOnService.DEFAULT_ELEMENT_LOCAL_NAME,
-//                SAMLConstants.SAML2_REDIRECT_BINDING_URI,
-//                SAMLConstants.SAML20PREQ_ATTRR_PREFIX, RequestedAttributes.SUPPORTS_REQUESTED_ATTRIBUTES_LOCAL_NAME,
-//                getDnsName());
-//    }
-//
-//    /**
-//     * Write the <IDPSSODescriptor>.
-//     */
-//    private void outputIDPSSO() {
-//        final List<String> protocols = new ArrayList<>(4);
-//        if (!args.isSaml1() && !args.isSaml2()) {
-//            return;
-//        }
-//        if (args.isSaml1()) {
-//            protocols.add(SAMLConstants.SAML20P_NS);
-//        }
-//        if (args.isSaml2()) {
-//            protocols.add(SAMLConstants.SAML20P_NS);
-//            protocols.add(SAMLConstants.SAML11P_NS);
-//            protocols.add("urn:mace:shibboleth:1.0");
-//        }
-//        output.format("    <%s protocolSupportEnumeration=\"%s\">\n",
-//                IDPSSODescriptor.DEFAULT_ELEMENT_LOCAL_NAME,
-//                String.join(" ", protocols));
-//
-//        outputExtensions(true);
-//
-//        outputKeyDescriptors(true);
-//
-//        if (args.isArtifact()) {
-//            outputArtifactEndpoints();
-//        }
-//
-//        if (args.isLogout()) {
-//            outputLogoutEndpoints();
-//        }
-//
-//        outputSSOEndpoints();
-//
-//        output.format("    </%s>\n", IDPSSODescriptor.DEFAULT_ELEMENT_LOCAL_NAME);
-//    }
-//
-//    /**
-//     * Write the <AttributeAuthorityDescriptor>.*/
-//    private void outputAtttributeAuthorityDescriptor() {
-//        final List<String> protocols;
-//
-//        if (args.isSaml1()) {
-//            if (args.isAttributeFetch()) {
-//                // Both
-//                protocols = Arrays.asList(SAMLConstants.SAML20P_NS, SAMLConstants.SAML11P_NS);
-//            } else {
-//                // SAML1 only
-//                protocols = Collections.singletonList(SAMLConstants.SAML11P_NS);
-//            }
-//        } else if (args.isAttributeFetch()) {
-//            // SAML2 only
-//            protocols = Collections.singletonList(SAMLConstants.SAML20P_NS);
-//        } else {
-//            // Neither
-//            return;
-//        }
-//
-//        output.format("    <%s protocolSupportEnumeration=\"%s\">\n",
-//                AttributeAuthorityDescriptor.DEFAULT_ELEMENT_LOCAL_NAME,
-//                String.join(" ", protocols));
-//
-//        outputExtensions(false);
-//        outputKeyDescriptors(true);
-//        if (args.isSaml1()) {
-//            output.format("        <%s Binding=\"%s\""
-//                    + " Location=\"https://%s:8443/idp/profile/SAML1/SOAP/AttributeQuery\"/>\n",
-//                    AttributeService.DEFAULT_ELEMENT_LOCAL_NAME,
-//                    SAMLConstants.SAML1_SOAP11_BINDING_URI,
-//                    getDnsName());
-//        }
-//        if (args.isAttributeFetch()) {
-//            output.format("        <%s Binding=\"%s\""
-//                    + " Location=\"https://%s:8443/idp/profile/SAML2/SOAP/AttributeQuery\"/>\n",
-//                    AttributeService.DEFAULT_ELEMENT_LOCAL_NAME,
-//                    SAMLConstants.SAML2_SOAP11_BINDING_URI,
-//                    getDnsName());
-//        }
-//        output.format("    </%s>\n", AttributeAuthorityDescriptor.DEFAULT_ELEMENT_LOCAL_NAME);
-//    }
-//
-//    /**
-//     * Write the <SPSSODescriptor>.
-//     */
-//    private void outputSPSSO() {
-//        if (!args.isSamlSP()) {
-//            return;
-//        }
-//        output.format("    <%s protocolSupportEnumeration=\"%s\">\n",
-//                SPSSODescriptor.DEFAULT_ELEMENT_LOCAL_NAME,
-//                SAMLConstants.SAML20P_NS);
-//
-//        outputKeyDescriptors(false);
-//
-//        output.format("        <%s Binding=\"%s\""
-//                + " Location=\"https://%s/idp/profile/Authn/SAML2/POST/SSO\" index=\"0\"/>\n",
-//                AssertionConsumerService.DEFAULT_ELEMENT_LOCAL_NAME,
-//                SAMLConstants.SAML2_POST_BINDING_URI,
-//                getDnsName());
-//
-//        output.format("    </%s>\n", SPSSODescriptor.DEFAULT_ELEMENT_LOCAL_NAME);
-//    }
-//
-//
-//    /** Output the metadata.
-//     * @return true iff this worked.
-//     */
-//    private int outputMetadata() {
-//        output.format("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
-//        output.format("   <!--\n");
-//        output.format("     This is example metadata only. Do *NOT* supply it as is without review,\n");
-//        output.format("     and do *NOT* provide it in real time to your partners.\n");
-//        output.format("     This metadata is not dynamic - run metadatagen again to recreate.\n");
-//        output.format("     Created: %s\n   -->\n", Instant.now().toString());
-//        output.format("<%s  xmlns=\"%s\" xmlns:%s=\"%s\"\n", EntityDescriptor.DEFAULT_ELEMENT_LOCAL_NAME,
-//                SAMLConstants.SAML20MD_NS,
-//                SignatureConstants.XMLSIG_PREFIX, SignatureConstants.XMLSIG_NS);
-//        output.format("      xmlns:%s=\"%s\" xmlns:%s=\"%s\"\n",
-//                ExtensionsConstants.SHIB_MDEXT10_PREFIX, ExtensionsConstants.SHIB_MDEXT10_NS,
-//                XMLConstants.XML_PREFIX, XMLConstants.XML_NS);
-//        output.format("      xmlns:%s=\"%s\" xmlns:%s=\"%s\"\n",
-//                SAMLConstants.SAML20MDUI_PREFIX, SAMLConstants.SAML20MDUI_NS,
-//                SAMLConstants.SAML20PREQ_ATTRR_PREFIX, SAMLConstants.SAML20PREQ_ATTR_NS);
-//        output.format(" validUntil=\"%s\" entityID=\"%s\">\n\n",
-//                DOMTypeSupport.instantToString(Instant.now()), 
-//                getApplicationContext().getEnvironment().getProperty("idp.entityID", "idp.example.org"));
-//        outputIDPSSO();
-//        outputAtttributeAuthorityDescriptor();
-//        outputSPSSO();
-//        output.format("</EntityDescriptor>\n");
-//        output.flush();
-//        output.close();
-//        return RC_OK;
-//    }
-
         
     /** {@inheritDoc} */
     @Override

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list