[java-identity-provider] 08/09: IDP-2106 Remove all API interfaces from the installer

Rod Widdowson rdw at steadingsoftware.com
Thu May 18 10:21:54 UTC 2023


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

rdw pushed a commit to branch main
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=0f6e002e64953848f0e234732ceca87ccedba0a9

commit 0f6e002e64953848f0e234732ceca87ccedba0a9
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Wed May 17 14:23:18 2023 +0100

    IDP-2106 Remove all API interfaces from the installer
    
    https://shibboleth.atlassian.net/browse/IDP-2106
    
    Remove the MetadataGenerator and MetadataGeneratorParameters Interfaces.
---
 .../idp/installer/MetadataGenerator.java           | 47 --------------
 .../idp/installer/MetadataGeneratorParameters.java | 74 ----------------------
 .../shibboleth/idp/installer/impl/V5Install.java   | 20 +++---
 .../metadata/impl/MetadataGeneratorImpl.java       | 20 +++---
 .../impl/MetadataGeneratorParametersImpl.java      | 42 +++++++++---
 5 files changed, 54 insertions(+), 149 deletions(-)

diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/MetadataGenerator.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/MetadataGenerator.java
deleted file mode 100644
index 9abab9270..000000000
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/MetadataGenerator.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements.  See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.idp.installer;
-
-import java.io.File;
-
-import javax.annotation.Nonnull;
-
-import org.apache.tools.ant.BuildException;
-
-import net.shibboleth.shared.component.InitializableComponent;
-
-/**
- * Interface to define Metadata Generation.
- */
-public interface MetadataGenerator extends InitializableComponent {
-
-    /** Set where to write the metadata.
-     * @param file what to set.
-     */
-    public void setOutput(@Nonnull File file);
-
-    /** Set a description of the IdP.
-     * @param what what to set.  This component does not have to be initialized.
-     */
-    public void setParameters(@Nonnull final MetadataGeneratorParameters what);
-
-    /** Generate the metadata given the parameters.
-     * @throws BuildException if badness occurs.
-     */
-    void generate() throws BuildException;
-}
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/MetadataGeneratorParameters.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/MetadataGeneratorParameters.java
deleted file mode 100644
index 61a9708ef..000000000
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/MetadataGeneratorParameters.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * Licensed to the University Corporation for Advanced Internet Development,
- * Inc. (UCAID) under one or more contributor license agreements.  See the
- * NOTICE file distributed with this work for additional information regarding
- * copyright ownership. The UCAID licenses this file to You under the Apache
- * License, Version 2.0 (the "License"); you may not use this file except in
- * compliance with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package net.shibboleth.idp.installer;
-
-import java.util.List;
-
-import javax.annotation.Nonnull;
-import javax.annotation.Nullable;
-
-import net.shibboleth.shared.annotation.constraint.NotEmpty;
-
-/**
- * Interface which describes metadata that needs to be generated.
- */
-public interface MetadataGeneratorParameters {
-
-    /**
-     * Get the (mutli-line) string representations of the encryption certs.
-     *
-     * @return Returns the encryption cert or null if none available.
-     */
-    @Nullable public List<String> getEncryptionCert();
-
-    /**
-     * Get the (mutli-line) string representation of the signing cert.
-     *
-     * @return Returns the signing cert or null if none available.
-     */
-    @Nullable public List<String> getSigningCert();
-
-    /**
-     * Get the (mutli-line)string representation of the back channel cert.
-     *
-     * @return Returns the back channel cert or null if non available.
-     */
-    @Nullable public List<String> getBackchannelCert();
-
-    /**
-     * Returns the entityID.
-     *
-     * @return the entityID.
-     */
-    @Nonnull @NotEmpty public String getEntityID();
-
-    /**
-     * Returns the dnsName (for use in endpoints).
-     *
-     * @return the dnsname.
-     */
-    @Nonnull @NotEmpty public String getDnsName();
-
-    /**
-     * Returns the scope used.
-     *
-     * @return the scope.
-     */
-    public String getScope();
-
-}
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/V5Install.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/V5Install.java
index 03ca3dfff..8ab632ccf 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/V5Install.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/V5Install.java
@@ -48,9 +48,9 @@ import org.springframework.core.io.Resource;
 
 import net.shibboleth.idp.Version;
 import net.shibboleth.idp.installer.InstallerSupport;
-import net.shibboleth.idp.installer.MetadataGenerator;
-import net.shibboleth.idp.installer.MetadataGeneratorParameters;
 import net.shibboleth.idp.installer.PropertiesWithComments;
+import net.shibboleth.idp.installer.metadata.impl.MetadataGeneratorImpl;
+import net.shibboleth.idp.installer.metadata.impl.MetadataGeneratorParametersImpl;
 import net.shibboleth.idp.installer.plugin.impl.PluginState;
 import net.shibboleth.idp.module.IdPModule;
 import net.shibboleth.idp.module.ModuleContext;
@@ -86,7 +86,7 @@ public class V5Install extends AbstractInitializableComponent {
     @Nonnull private final KeyManagement keyManager;
 
     /** What will generate metadata? */
-    private MetadataGenerator metadataGenerator;
+    private MetadataGeneratorImpl metadataGenerator;
 
     /** Constructor.
      * @param props The properties to drive the installs.
@@ -130,13 +130,13 @@ public class V5Install extends AbstractInitializableComponent {
         reprotect();
     }
 
-    /** Set the {@link MetadataGenerator}.
+    /** Set the {@link MetadataGeneratorImpl}.
      * @param what what to set.  This need not have been initialized yet
-     * {@link MetadataGenerator#setOutput(File)} and
-     * {@link MetadataGenerator#setParameters(MetadataGeneratorParameters)} are called
+     * {@link MetadataGeneratorImpl#setOutput(File)} and
+     * {@link MetadataGeneratorImpl#setParameters(MetadataGeneratorParametersImpl)} are called
      * prior to initialization.
      */
-    public void setMetadataGenerator(final MetadataGenerator what) {
+    public void setMetadataGenerator(final MetadataGeneratorImpl what) {
         checkSetterPreconditions();
         metadataGenerator = what;
     }
@@ -476,13 +476,13 @@ public class V5Install extends AbstractInitializableComponent {
         }
         final Resource resource = new ClassPathResource("net/shibboleth/idp/installer/metadata-generator.xml");
         final GenericApplicationContext context = new ApplicationContextBuilder()
-                .setName(MetadataGenerator.class.getName())
+                .setName(MetadataGeneratorImpl.class.getName())
                 .setServiceConfigurations(CollectionSupport.singletonList(resource))
                 .setContextInitializer(new Initializer())
                 .build();
 
-        final MetadataGeneratorParameters parameters = context.getBean("IdPConfiguration",
-                MetadataGeneratorParameters.class);
+        final MetadataGeneratorParametersImpl parameters = context.getBean("IdPConfiguration",
+                MetadataGeneratorParametersImpl.class);
 
         log.info("Creating Metadata to {}", metadataFile);
         log.debug("Parameters {}", parameters);
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/metadata/impl/MetadataGeneratorImpl.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/metadata/impl/MetadataGeneratorImpl.java
index 968fb0396..2b4181af5 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/metadata/impl/MetadataGeneratorImpl.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/metadata/impl/MetadataGeneratorImpl.java
@@ -54,8 +54,6 @@ import org.opensaml.xmlsec.signature.X509Certificate;
 import org.opensaml.xmlsec.signature.X509Data;
 import org.opensaml.xmlsec.signature.support.SignatureConstants;
 
-import net.shibboleth.idp.installer.MetadataGenerator;
-import net.shibboleth.idp.installer.MetadataGeneratorParameters;
 import net.shibboleth.idp.saml.xmlobject.ExtensionsConstants;
 import net.shibboleth.idp.saml.xmlobject.Scope;
 import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
@@ -71,7 +69,7 @@ import net.shibboleth.shared.xml.XMLConstants;
  * This class gathers information which it then uses to generate IdP Metadata. Loosely based on the SP metadata
  * generator, and the V2 metadata.
  */
-public class MetadataGeneratorImpl extends AbstractInitializableComponent implements MetadataGenerator {
+public class MetadataGeneratorImpl extends AbstractInitializableComponent {
 
     /**
      * The end points we understand.
@@ -166,7 +164,7 @@ public class MetadataGeneratorImpl extends AbstractInitializableComponent implem
     private File output;
 
     /** The parameters. */
-    private MetadataGeneratorParameters params;
+    private MetadataGeneratorParametersImpl params;
 
     /** {@inheritDoc} */
     protected void doInitialize() throws ComponentInitializationException {
@@ -180,14 +178,18 @@ public class MetadataGeneratorImpl extends AbstractInitializableComponent implem
         endpoints = EnumSet.allOf(Endpoints.class);
     }
 
-    /** {@inheritDoc} */
+    /** Set where to write the metadata.
+     * @param file what to set.
+     */
     public void setOutput(@Nonnull final File file) {
         checkSetterPreconditions();
         output = Constraint.isNotNull(file, "provided file must be nonnull");
     }
 
-    /** {@inheritDoc} */
-    public void setParameters(@Nonnull final MetadataGeneratorParameters what) {
+    /** Set a description of the IdP.
+     * @param what what to set.  This component does not have to be initialized.
+     */
+    public void setParameters(@Nonnull final MetadataGeneratorParametersImpl what) {
         checkSetterPreconditions();
         params = Constraint.isNotNull(what, "provided params must be nonnull");
     }
@@ -272,7 +274,9 @@ public class MetadataGeneratorImpl extends AbstractInitializableComponent implem
         saml2LogoutCommented = asComment;
     }
 
-    /** {@inheritDoc} */
+    /** Generate the metadata given the parameters.
+     * @throws BuildException if badness occurs.
+     */
     public void generate() throws BuildException {
         checkComponentActive();
         try {
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/metadata/impl/MetadataGeneratorParametersImpl.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/metadata/impl/MetadataGeneratorParametersImpl.java
index 77308e2ff..7e46ad235 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/metadata/impl/MetadataGeneratorParametersImpl.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/metadata/impl/MetadataGeneratorParametersImpl.java
@@ -29,17 +29,15 @@ import javax.annotation.Nullable;
 
 import org.springframework.core.io.Resource;
 
-import net.shibboleth.idp.installer.MetadataGeneratorParameters;
 import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
 import net.shibboleth.shared.annotation.constraint.NotEmpty;
 import net.shibboleth.shared.component.AbstractInitializableComponent;
 import net.shibboleth.shared.component.ComponentInitializationException;
 
 /**
- * Implementation of {@link MetadataGeneratorParameters}.
+ * Parameters to metadata generation
  */
-public class MetadataGeneratorParametersImpl extends AbstractInitializableComponent
-    implements MetadataGeneratorParameters {
+public class MetadataGeneratorParametersImpl extends AbstractInitializableComponent {
 
     /**
      * The file with the certificate the IDP uses to encrypt.
@@ -97,7 +95,11 @@ public class MetadataGeneratorParametersImpl extends AbstractInitializableCompon
         }
     }
 
-    /**  {@inheritDoc} */
+    /**
+     * Get the (mutli-line) string representations of the encryption certs.
+     *
+     * @return Returns the encryption cert or null if none available.
+     */
     @Nullable public List<String> getEncryptionCert() {
         return encryptionCerts;
     }
@@ -116,7 +118,11 @@ public class MetadataGeneratorParametersImpl extends AbstractInitializableCompon
         }
     }
 
-    /**  {@inheritDoc} */
+    /**
+     * Get the (mutli-line) string representation of the signing cert.
+     *
+     * @return Returns the signing cert or null if none available.
+     */
     @Nullable public List<String> getSigningCert() {
         return signingCerts;
     }
@@ -134,7 +140,11 @@ public class MetadataGeneratorParametersImpl extends AbstractInitializableCompon
         }
     }
 
-    /**  {@inheritDoc} */
+    /**
+     * Get the (mutli-line)string representation of the back channel cert.
+     *
+     * @return Returns the back channel cert or null if non available.
+     */
     @Nullable public List<String> getBackchannelCert() {
         return backChannelCerts;
     }
@@ -196,7 +206,11 @@ public class MetadataGeneratorParametersImpl extends AbstractInitializableCompon
         }
     }
 
-    /**  {@inheritDoc} */
+    /**
+     * Returns the entityID.
+     *
+     * @return the entityID.
+     */
     @Nonnull @NotEmpty public String getEntityID() {
         assert entityID != null;
         return entityID;
@@ -211,7 +225,11 @@ public class MetadataGeneratorParametersImpl extends AbstractInitializableCompon
         entityID = id;
     }
 
-    /**  {@inheritDoc} */
+    /**
+     * Returns the dnsName (for use in endpoints).
+     *
+     * @return the dnsname.
+     */
     @Nonnull @NotEmpty public String getDnsName() {
         assert dnsName != null;
         return dnsName;
@@ -226,7 +244,11 @@ public class MetadataGeneratorParametersImpl extends AbstractInitializableCompon
         dnsName = name;
     }
 
-    /**  {@inheritDoc} */
+    /**
+     * Returns the scope used.
+     *
+     * @return the scope.
+     */
     public String getScope() {
         return scope;
     }

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


More information about the commits mailing list