[java-idp-plugin-metadatagen] branch dev/JMETAGEN-5 updated: JMETAGEN-5 - Metadata generation

Scott Cantor cantor.2 at osu.edu
Thu Jul 13 15:12:03 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=3c31713c893298e75a27310dcec23deee2aedcfe

The following commit(s) were added to refs/heads/dev/JMETAGEN-5 by this push:
     new 3c31713  JMETAGEN-5 - Metadata generation
3c31713 is described below

commit 3c31713c893298e75a27310dcec23deee2aedcfe
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Jul 13 11:12:00 2023 -0400

    JMETAGEN-5 - Metadata generation
    
    https://shibboleth.atlassian.net/browse/JMETAGEN-5
    
    Add Scope extension.
---
 .../plugin/metadatagen/impl/MetadataGenCLI.java    | 74 ----------------------
 .../impl/MetadataGenCommandLineArguments.java      | 23 +++++--
 .../plugin/metadatagen/impl/MetadataGenTest.java   |  1 +
 3 files changed, 20 insertions(+), 78 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 b4080a6..729df48 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
@@ -125,80 +125,6 @@ public final class MetadataGenCLI extends AbstractIdPHomeAwareCommandLine<Metada
         return getClass().getPackage().getImplementationVersion();
     }
 
-//    /**
-//     * Write out any <KeyDescriptor>Elements.
-//     * @param outputBackChannel  Do we output the back channel certificates?
-//     */
-//    private void outputKeyDescriptors(final boolean outputBackChannel) {
-//        final List<List<String>> signing = new ArrayList<>(2);
-//        if (outputBackChannel) {
-//            final List<String> backCert = parameters.getBackchannelCert();
-//            if (backCert != null && !backCert.isEmpty()) {
-//                output.format("        <!--  First signing certificate is BackChannel, the Second is FrontChannel -->\n");
-//                signing.add(backCert);
-//            }
-//        }
-//        final List<String> signCert = parameters.getSigningCert();
-//        if (signCert != null && !signCert.isEmpty()) {
-//            signing.add(signCert);
-//        }
-//        outputKeyDescriptors(signing, "signing");
-//        outputKeyDescriptors(Collections.singletonList(parameters.getEncryptionCert()), "encryption");
-//        output.format("\n");
-//    }
-//
-//    /**
-//     * Write out <KeyDescriptor>Elements. of a specific type
-//     *
-//     * @param certs the certificates
-//     * @param use the type - signing or encryption
-//     */
-//    private void outputKeyDescriptors(@Nullable final List<List<String>> certs, @Nonnull @NotEmpty final String use) {
-//
-//        if (null == certs || certs.isEmpty()) {
-//            return;
-//        }
-//        for (final List<String> cert : certs) {
-//            output.format("        <%s use=\"%s\">\n",KeyDescriptor.DEFAULT_ELEMENT_LOCAL_NAME, use);
-//            output.format("          <%s:%s>\n", SignatureConstants.XMLSIG_PREFIX, KeyInfo.DEFAULT_ELEMENT_LOCAL_NAME);
-//            output.format("            <%s:%s>\n",
-//                    SignatureConstants.XMLSIG_PREFIX, X509Data.DEFAULT_ELEMENT_LOCAL_NAME);
-//            output.format("              <%s:%s>\n",
-//                    SignatureConstants.XMLSIG_PREFIX, X509Certificate.DEFAULT_ELEMENT_LOCAL_NAME);
-//            output.format("%s\n",String.join("\n", cert));
-//            output.format("              </%s:%s>\n",
-//                    SignatureConstants.XMLSIG_PREFIX, X509Certificate.DEFAULT_ELEMENT_LOCAL_NAME);
-//            output.format("            </%s:%s>\n",
-//                    SignatureConstants.XMLSIG_PREFIX, X509Data.DEFAULT_ELEMENT_LOCAL_NAME);
-//            output.format("          </%s:%s>\n",SignatureConstants.XMLSIG_PREFIX, KeyInfo.DEFAULT_ELEMENT_LOCAL_NAME);
-//            output.format("        </%s>\n\n",KeyDescriptor.DEFAULT_ELEMENT_LOCAL_NAME);
-//        }
-//    }
-//
-//    /** Output the MDUI for one language.
-//     * @param lang the language to emit
-//     *
-//     */
-//    private void outputMDUI(final String lang) {
-//        final Environment env = getApplicationContext().getEnvironment();
-//        final String displayName = env.getProperty(MetadataGenCommandLineArguments.MDUI_DISPLAY_NAME_PREFIX+lang);
-//        if (displayName != null) {
-//            output.format("            <%s:%s %s:%s=\"%s\">%s</%s:%s>\n",
-//                    SAMLConstants.SAML20MDUI_PREFIX, DisplayName.DEFAULT_ELEMENT_LOCAL_NAME,
-//                    XMLConstants.XML_PREFIX, LangBearing.XML_LANG_ATTR_LOCAL_NAME,
-//                    lang, displayName,
-//                    SAMLConstants.SAML20MDUI_PREFIX, DisplayName.DEFAULT_ELEMENT_LOCAL_NAME);
-//        }
-//        final String description = env.getProperty(MetadataGenCommandLineArguments.MDUI_DESCRIPTION_PREFIX+lang);
-//        if (description != null) {
-//            output.format("            <%s:%s %s:%s=\"%s\">%s</%s:%s>\n",
-//                    SAMLConstants.SAML20MDUI_PREFIX, Description.DEFAULT_ELEMENT_LOCAL_NAME,
-//                    XMLConstants.XML_PREFIX, LangBearing.XML_LANG_ATTR_LOCAL_NAME,
-//                    lang, description,
-//                    SAMLConstants.SAML20MDUI_PREFIX, Description.DEFAULT_ELEMENT_LOCAL_NAME);
-//        }
-//    }
-//
 //    /** Output Scope and MDUI.
 //     * @param includeMDUI do we output the MDUI
 //     */
diff --git a/metadatagen-impl/src/main/java/net/shibboleth/idp/plugin/metadatagen/impl/MetadataGenCommandLineArguments.java b/metadatagen-impl/src/main/java/net/shibboleth/idp/plugin/metadatagen/impl/MetadataGenCommandLineArguments.java
index 2d608c0..877d907 100644
--- a/metadatagen-impl/src/main/java/net/shibboleth/idp/plugin/metadatagen/impl/MetadataGenCommandLineArguments.java
+++ b/metadatagen-impl/src/main/java/net/shibboleth/idp/plugin/metadatagen/impl/MetadataGenCommandLineArguments.java
@@ -63,6 +63,7 @@ import com.google.common.collect.ArrayListMultimap;
 import com.google.common.collect.Multimap;
 
 import net.shibboleth.idp.cli.AbstractIdPHomeAwareCommandLineArguments;
+import net.shibboleth.idp.saml.xmlobject.ExtensionsConstants;
 import net.shibboleth.shared.annotation.constraint.Live;
 import net.shibboleth.shared.annotation.constraint.NotLive;
 import net.shibboleth.shared.annotation.constraint.Unmodifiable;
@@ -102,6 +103,10 @@ public class MetadataGenCommandLineArguments extends AbstractIdPHomeAwareCommand
     @Parameter(names = {"--entityID", "--client_id", "--id"}, required=true, description="Unique ID for entity")
     @Nullable private String entityID;
 
+    /** Scopes. */
+    @Parameter(names = {"--scope"}, description="Scope extension value")
+    @Nonnull private List<String> scopes = new ArrayList<>();
+    
     /** Do we output an SP role? */
     @Parameter(names = {"--sp"}, description="Include Service Provider role?")
     private boolean sp;
@@ -211,6 +216,11 @@ public class MetadataGenCommandLineArguments extends AbstractIdPHomeAwareCommand
         return entityID;
     }
     
+    /** {@inheritDoc} */
+    @Nonnull @Unmodifiable @NotLive public List<String> getScopes() {
+        return scopes;
+    }
+    
     /** {@inheritDoc} */
     @Nullable public String getLang() {
         if (getLanguageRanges().isEmpty()) {
@@ -512,6 +522,10 @@ public class MetadataGenCommandLineArguments extends AbstractIdPHomeAwareCommand
             namespaces.add(new Namespace(SAMLConstants.SAML20MDATTR_NS, SAMLConstants.SAML20MDATTR_PREFIX));
             namespaces.add(new Namespace(SAMLConstants.SAML20_NS, "saml"));
         }
+        
+        if (!scopes.isEmpty()) {
+            namespaces.add(new Namespace(ExtensionsConstants.SHIB_MDEXT10_NS, ExtensionsConstants.SHIB_MDEXT10_PREFIX));
+        }
 
         final SPSSODescriptor role = getSPSSODescriptor();
         if (role != null && role.isSupportedProtocol(AssertionConsumerServiceConverter.OPENID_PROTOCOL)) {
@@ -553,10 +567,11 @@ public class MetadataGenCommandLineArguments extends AbstractIdPHomeAwareCommand
     public void printHelp(@Nonnull final PrintStream out) {
         super.printHelp(out);
         out.println(String.format("  %-20s %s", "--entityID, --client_id, --id", "The entityID (or client_id, etc.)"));
-
-        out.println(String.format("  %-20s %s", "--sp", "Include SP role."));
-        out.println(String.format("  %-20s %s", "--idp", "Include IdP role."));
-        out.println(String.format("  %-20s %s", "--aa", "Include Attribute Authority role."));
+        out.println(String.format("  %-20s %s", "--scope", "Scope extension value"));
+        
+        out.println(String.format("  %-20s %s", "--sp", "Include SP role?"));
+        out.println(String.format("  %-20s %s", "--idp", "Include IdP role?"));
+        out.println(String.format("  %-20s %s", "--aa", "Include Attribute Authority role?"));
 
         out.println(String.format("  %-20s %s", "--sso", "Binding/Endpoint for SingleSignOnService"));
         out.println(String.format("  %-20s %s", "--logout, --slo", "Binding/Endpoint for SingleLogoutService"));
diff --git a/metadatagen-impl/src/test/java/net/shibboleth/idp/plugin/metadatagen/impl/MetadataGenTest.java b/metadatagen-impl/src/test/java/net/shibboleth/idp/plugin/metadatagen/impl/MetadataGenTest.java
index 94d2c0a..e663fcc 100644
--- a/metadatagen-impl/src/test/java/net/shibboleth/idp/plugin/metadatagen/impl/MetadataGenTest.java
+++ b/metadatagen-impl/src/test/java/net/shibboleth/idp/plugin/metadatagen/impl/MetadataGenTest.java
@@ -51,6 +51,7 @@ public class MetadataGenTest {
                         "--idp",
                         "--aa",
                         "--entityID", "https://sp.example.org",
+                        "--scope", "example.org",
                         "--cert", "/Users/scantor/Desktop/webauth2.crt",
                         "--sso", "Redirect1/idp.example.org/idp/profile/SAML/SSO/Redirect",
                         "--sso", "Redirect/idp.example.org/idp/profile/SAML2/SSO/Redirect",

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


More information about the commits mailing list