[java-identity-provider] branch main updated: IDP-2385 Allow installer control of the Base IdP URL (idp/profile) in the metadata

Rod Widdowson rdw at steadingsoftware.com
Mon Nov 10 19:28:27 UTC 2025


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:
https://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=9c167f37f03bf78f01d72c72951fe688133d734a

The following commit(s) were added to refs/heads/main by this push:
     new 9c167f37f IDP-2385 Allow installer control of the Base IdP URL (idp/profile) in the metadata
9c167f37f is described below

commit 9c167f37f03bf78f01d72c72951fe688133d734a
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sun Nov 9 15:28:55 2025 +0000

    IDP-2385 Allow installer control of the Base IdP URL (idp/profile) in the metadata
    
    https://shibboleth.atlassian.net/browse/IDP-2385
    
    Modify and commit submitted patch.  A new installer property idp.context.path
    allows the IdP metadata to be modified.
---
 .../idp/installer/InstallerProperties.java         |  7 +++-
 .../impl/InstalledMetadataParameters.java          | 39 +++++++++++++++++-----
 .../installer/impl/InstallerPropertiesImpl.java    | 15 ++++++++-
 .../shibboleth/idp/installer/impl/V5Install.java   |  1 +
 4 files changed, 52 insertions(+), 10 deletions(-)

diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerProperties.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerProperties.java
index bfb094d21..978632099 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerProperties.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerProperties.java
@@ -76,8 +76,13 @@ public final class InstallerProperties {
     /** Whether to tidy up after ourselves. */
     @Nonnull @NotEmpty public static final String NO_TIDY = "idp.no.tidy";
 
+    /** The base URL for IdP endpoints. */
+    @Nonnull @NotEmpty public static final String CONTEXT_PATH = "idp.context.path";
+
     /** Key size for all installer-generated keys. */
     public static final int DEFAULT_KEY_SIZE = 3072;
-
+    
+    /** The default context path */
+    public static final String DEFAULT_CONTEXT_PATH = "/idp";
 
 }
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstalledMetadataParameters.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstalledMetadataParameters.java
index 8e5f85747..f0d2079f9 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstalledMetadataParameters.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstalledMetadataParameters.java
@@ -58,7 +58,7 @@ import net.shibboleth.shared.component.AbstractInitializableComponent;
 import net.shibboleth.shared.component.ComponentInitializationException;
 import net.shibboleth.shared.primitive.LoggerFactory;
 import net.shibboleth.shared.resource.Resource;
-
+import net.shibboleth.idp.installer.InstallerProperties;
 /**
  * Parameters to metadata generation.
  */
@@ -92,23 +92,45 @@ public class InstalledMetadataParameters extends AbstractInitializableComponent
     /** The scope. */
     @Nullable private String scope;
 
+    /** The base URL for IdP endpoints. */
+    @NonnullAfterInit private String contextPath = InstallerProperties.DEFAULT_CONTEXT_PATH;
+
     /*
      * Static settings.
      */
     /** logout services. */
-    @Nonnull private final List<Pair<String, String>> logoutServices = CollectionSupport.listOf(
-            new Pair<>("Redirect/","/idp/profile/SAML2/Redirect/SLO"),
-            new Pair<>("POST/","/idp/profile/SAML2/POST/SLO"));
+    @Nonnull private List<Pair<String, String>> logoutServices;
 
     /** sso services. */
-    @Nonnull private final List<Pair<String, String>> ssoServices = CollectionSupport.listOf(
-            new Pair<>("SimpleSign/","/idp/profile/SAML2/POST-SimpleSign/SSO"),
-            new Pair<>("Redirect/","/idp/profile/SAML2/Redirect/SSO"),
-            new Pair<>("POST/","/idp/profile/SAML2/POST/SSO"));
+    @Nonnull private List<Pair<String, String>> ssoServices;
 
     /** artifact services. */
     @Nonnull private final List<Pair<String, String>> artifactServices = CollectionSupport.emptyList();
 
+    /** Setup services lists {@link #logoutServices} {#link {@link #ssoServices}, consulting {@link #contextPath}. */
+    private void setupSevices() {
+        logoutServices = CollectionSupport.singletonList(
+                new Pair<>("Redirect/", contextPath + "/profile/SAML2/SOAP/Redirect/SLO"),
+                new Pair<>("POST/", contextPath + "/profile/SAML2/POST/SLO"));
+
+        ssoServices = CollectionSupport.listOf(
+                new Pair<>("SimpleSign/", contextPath + "/profile/SAML2/POST-SimpleSign/SSO"),
+                new Pair<>("Redirect/", contextPath + "/profile/SAML2/Redirect/SSO"),
+                new Pair<>("POST/", contextPath + "/profile/SAML2/POST/SSO"));        
+    }
+    
+    /**
+     * Sets the context path for IdP endpoints.
+     *
+     * @param what what to set.
+     */
+    public void setContextPath(@Nonnull final String what) {
+        contextPath = what;
+        if (isInitialized()) {
+            setupSevices();
+        }
+    }
+
     /** {@inheritDoc} */
     protected void doInitialize() throws ComponentInitializationException {
         if (entityID == null || entityID.isEmpty()) {
@@ -117,6 +139,7 @@ public class InstalledMetadataParameters extends AbstractInitializableComponent
         if (dnsName == null || dnsName.isEmpty()) {
             throw new ComponentInitializationException("DNS name not specified");
         }
+        setupSevices() ;
     }
 
     /**
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstallerPropertiesImpl.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstallerPropertiesImpl.java
index 9bd2bcaf8..8473dd1d6 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstallerPropertiesImpl.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/impl/InstallerPropertiesImpl.java
@@ -484,6 +484,19 @@ public class InstallerPropertiesImpl  {
         return "https://" + getHostName() + "/idp/shibboleth";
     }
 
+    /**
+     * Get the context path URL for IdP endpoints.
+     * 
+     * @return the base URL
+     */
+    @Nonnull public String getContextPath() {
+        String result = installerProperties.getProperty(InstallerProperties.CONTEXT_PATH);
+        if (result == null) {
+            result = InstallerProperties.DEFAULT_CONTEXT_PATH;
+        }
+        return result;
+    }
+
     /**
      * Get the password for the keystore for this installation.
      * 
@@ -536,7 +549,7 @@ public class InstallerPropertiesImpl  {
         result.addAll(Arrays.asList(modules));
         return CollectionSupport.copyToSet(result);
     }
-    
+
     /** Get the modules to enable before ant install.
      * @return the modules
      */
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 03de3173d..baaafce27 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
@@ -509,6 +509,7 @@ public class V5Install {
         final InstalledMetadataParameters parameters =
                 context.getBean("IdPConfiguration", InstalledMetadataParameters.class);
         parameters.setDnsName(installerProps.getHostName());
+        parameters.setContextPath(installerProps.getContextPath());
         final VelocityEngine engine = context.getBean("VelocityEngine", VelocityEngine.class);
         log.debug("Parameters {}", parameters);
         try (final Writer sink = new FileWriter(metadataFile)) {

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


More information about the commits mailing list