[java-idp-oidc] 03/03: Properly handle empty redirect URI set and (custom) URIs with no host

Codeberg noreply at shibboleth.net
Thu Nov 26 15:19:27 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/d23b4c9056c2cdd373322f811674f9131f1e3eb9

commit d23b4c9056c2cdd373322f811674f9131f1e3eb9
Author: Henri Mikkonen <henri.mikkonen at iki.fi>
AuthorDate: Thu Nov 26 17:18:28 2026 +0200

    Properly handle empty redirect URI set and (custom) URIs with no host
---
 .../context/navigate/SectorIdentifierLookupFunction.java     | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/idp-oidc-extension-api/src/main/java/net/shibboleth/idp/plugin/oidc/op/profile/context/navigate/SectorIdentifierLookupFunction.java b/idp-oidc-extension-api/src/main/java/net/shibboleth/idp/plugin/oidc/op/profile/context/navigate/SectorIdentifierLookupFunction.java
index 89721594..a0e1fdc0 100644
--- a/idp-oidc-extension-api/src/main/java/net/shibboleth/idp/plugin/oidc/op/profile/context/navigate/SectorIdentifierLookupFunction.java
+++ b/idp-oidc-extension-api/src/main/java/net/shibboleth/idp/plugin/oidc/op/profile/context/navigate/SectorIdentifierLookupFunction.java
@@ -14,7 +14,6 @@
 
 package net.shibboleth.idp.plugin.oidc.op.profile.context.navigate;
 
-import java.net.URI;
 import java.util.Set;
 import java.util.function.Function;
 import java.util.stream.Collectors;
@@ -41,6 +40,9 @@ import com.nimbusds.openid.connect.sdk.rp.OIDCClientMetadata;
  * case there is no sector_identifier_uri. In the latter case there must be only on registered redirect_uri or null is
  * returned.
  * 
+ * Since 4.4.0, it's also verified that set of redirect URIs may not include null or multiple hosts without sector ID
+ * URI.
+ * 
  * <p>
  * If a specific setting is unavailable, a null value is returned.
  * </p>
@@ -95,12 +97,16 @@ public class SectorIdentifierLookupFunction extends AbstractIdentifiableInitiali
             final String sectorIdentifier = clientMetadata.getSectorIDURI().getHost();
             log.debug("Sector identifier resolved by registered sector uri {}", sectorIdentifier);
             return sectorIdentifier;
-        } else if (clientMetadata.getRedirectionURIs() == null) {
+        } else if (clientMetadata.getRedirectionURIs() == null || clientMetadata.getRedirectionURIs().isEmpty()) {
             log.warn("Redirection uri not available, unable to determine sector identifier");
             return null;
         }
         final Set<String> hosts = clientMetadata.getRedirectionURIs().stream()
-                .map(URI::getHost).collect(Collectors.toSet());
+                .map(uri -> uri.getHost()).collect(Collectors.toSet());
+        if (hosts.contains(null)) {
+            log.warn("Empty hosts found from the redirection uris but no registered sector uri");
+            return null;
+        }
         if (hosts.size() > 1) {
             log.warn("Multiple hosts found from the redirection uris but no registered sector uri");
             return null;

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


More information about the commits mailing list