[java-idp-oidc] branch main updated: JOIDC-325 - Perform mandatory checks for the request URIs during registration

Codeberg noreply at shibboleth.net
Fri Nov 27 10:08:58 UTC 2026


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

codeberg pushed a commit to branch main
in repository java-idp-oidc.

View the commit online:
https://codeberg.org/Shibboleth/java-idp-oidc/commit/a8571048d2e3acf109d986e41fb880d8c5f5e58d

The following commit(s) were added to refs/heads/main by this push:
     new a8571048 JOIDC-325 - Perform mandatory checks for the request URIs during registration
a8571048 is described below

commit a8571048d2e3acf109d986e41fb880d8c5f5e58d
Author: Henri Mikkonen <henri.mikkonen at iki.fi>
AuthorDate: Fri Nov 27 12:08:29 2026 +0200

    JOIDC-325 - Perform mandatory checks for the request URIs during registration
    
    https://shibboleth.atlassian.net/browse/JOIDC-325
---
 .../impl/AddRequestUrisToClientMetadata.java       | 35 ++++++++++++++++++----
 .../impl/AddRequestUrisToClientMetadataTest.java   | 20 +++++++++++++
 2 files changed, 50 insertions(+), 5 deletions(-)

diff --git a/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/AddRequestUrisToClientMetadata.java b/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/AddRequestUrisToClientMetadata.java
index dbd545a1..a9028c96 100644
--- a/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/AddRequestUrisToClientMetadata.java
+++ b/idp-oidc-extension-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/AddRequestUrisToClientMetadata.java
@@ -14,22 +14,47 @@
 
 package net.shibboleth.idp.plugin.oidc.op.profile.impl;
 
+import java.net.URI;
+import java.util.Set;
+
 import javax.annotation.Nonnull;
 
+import org.opensaml.profile.action.ActionSupport;
+import org.opensaml.profile.action.EventIds;
 import org.opensaml.profile.context.ProfileRequestContext;
+import org.slf4j.Logger;
 
 import com.nimbusds.openid.connect.sdk.rp.OIDCClientMetadata;
 
+import net.shibboleth.shared.primitive.LoggerFactory;
+
 /**
- * Adds the pre-registered request_uri values to the output {@link OIDCClientMetadata}. The values are expected to be
- * already validated. The validation can be done via metadata policy.
+ * Adds the pre-registered request_uri values to the output {@link OIDCClientMetadata}. It validates that all the
+ * URIs use https-scheme and contain a host.
  */
 public class AddRequestUrisToClientMetadata extends AbstractOIDCClientMetadataPopulationAction {
 
+    /** Class logger. */
+    @Nonnull private final Logger log = LoggerFactory.getLogger(AddRequestUrisToClientMetadata.class);
+
     /** {@inheritDoc} */
     @Override
     protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
-        getOutputMetadata().setRequestObjectURIs(getInputMetadata().getRequestObjectURIs());
+        final Set<URI> requestUris = getInputMetadata().getRequestObjectURIs();
+        if (requestUris != null) {
+            for (final URI uri : requestUris) {
+                if (!"https".equalsIgnoreCase(uri.getScheme())) {
+                    log.warn("{} request_uri {} is not in 'https' scheme", getLogPrefix(), uri);
+                    ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MESSAGE);
+                    return;
+                }
+                if (uri.getHost() == null) {
+                    log.warn("{} The request_uri {} has no host", getLogPrefix(), uri);
+                    ActionSupport.buildEvent(profileRequestContext, EventIds.INVALID_MESSAGE);
+                    return;
+                }
+            }
+            getOutputMetadata().setRequestObjectURIs(requestUris);
+        }
     }
-
-}
\ No newline at end of file
+}
diff --git a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/AddRequestUrisToClientMetadataTest.java b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/AddRequestUrisToClientMetadataTest.java
index 13fca80e..faa518f8 100644
--- a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/AddRequestUrisToClientMetadataTest.java
+++ b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/impl/AddRequestUrisToClientMetadataTest.java
@@ -18,12 +18,14 @@ import java.net.URI;
 import java.net.URISyntaxException;
 import java.util.Set;
 
+import org.opensaml.profile.action.EventIds;
 import org.testng.Assert;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 import com.nimbusds.openid.connect.sdk.rp.OIDCClientMetadata;
 
+import net.shibboleth.idp.profile.testing.ActionTestingSupport;
 import net.shibboleth.shared.component.ComponentInitializationException;
 
 /**
@@ -72,4 +74,22 @@ public class AddRequestUrisToClientMetadataTest extends BaseOIDCClientMetadataPo
         Assert.assertEquals(resultUris, Set.of(requestUri1, requestUri2));
     }
 
+    @Test
+    public void testSetHttpRejected() throws ComponentInitializationException {
+        final OIDCClientMetadata input = new OIDCClientMetadata();
+        input.setRequestObjectURIs(Set.of(requestUri1, requestUri2, URI.create("http://example.org/object3")));
+        final OIDCClientMetadata output = new OIDCClientMetadata();
+        setUpContext(input, output);
+        ActionTestingSupport.assertEvent(action.execute(requestCtx), EventIds.INVALID_MESSAGE);
+    }
+
+    @Test
+    public void testSetHttpsNoHost() throws ComponentInitializationException {
+        final OIDCClientMetadata input = new OIDCClientMetadata();
+        input.setRequestObjectURIs(Set.of(requestUri1, requestUri2, URI.create("https:///object3")));
+        final OIDCClientMetadata output = new OIDCClientMetadata();
+        setUpContext(input, output);
+        ActionTestingSupport.assertEvent(action.execute(requestCtx), EventIds.INVALID_MESSAGE);
+    }
+
 }

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


More information about the commits mailing list