[java-oidfed-common] 01/05: Switched entity-statement content-type validation into ignoring parameters.

Codeberg noreply at shibboleth.net
Fri May 22 10:52:48 UTC 2026


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

codeberg pushed a commit to branch main
in repository java-oidfed-common.

View the commit online:
https://codeberg.org/Shibboleth/java-oidfed-common/commit/9b72407c2ef38b07776d65225245613e813b704d

commit 9b72407c2ef38b07776d65225245613e813b704d
Author: Henri Mikkonen <henri.mikkonen at iki.fi>
AuthorDate: Thu May 21 08:38:18 2026 +0300

    Switched entity-statement content-type validation into ignoring parameters.
    
    The validation is done by Apache HC ContentType.isSameMimeType(..). This way we ignore parameters such as charset.
---
 .../configuration/DefaultEntityConfigurationFetchingStrategy.java     | 4 +++-
 .../metadata/cache/keyset/DefaultSignedKeysetFetchingStrategy.java    | 4 +++-
 .../resolver/DefaultResolveEntityTrustChainFetchingStrategy.java      | 3 ++-
 .../subordinate/DefaultSubordinateStatementFetchingStrategy.java      | 3 ++-
 .../metadata/cache/trustmark/DefaultTrustMarkFetchingStrategy.java    | 3 ++-
 .../cache/trustmark/DefaultTrustMarkStatusFetchingStrategy.java       | 3 ++-
 6 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/configuration/DefaultEntityConfigurationFetchingStrategy.java b/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/configuration/DefaultEntityConfigurationFetchingStrategy.java
index 201dab2..a4f7066 100644
--- a/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/configuration/DefaultEntityConfigurationFetchingStrategy.java
+++ b/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/configuration/DefaultEntityConfigurationFetchingStrategy.java
@@ -25,6 +25,7 @@ import javax.annotation.Nullable;
 import org.apache.hc.client5.http.classic.methods.HttpGet;
 import org.apache.hc.core5.http.ClassicHttpRequest;
 import org.apache.hc.core5.http.ClassicHttpResponse;
+import org.apache.hc.core5.http.ContentType;
 import org.apache.hc.core5.http.ProtocolException;
 import org.apache.hc.core5.http.io.entity.EntityUtils;
 import org.apache.hc.core5.net.URIBuilder;
@@ -98,7 +99,8 @@ public class DefaultEntityConfigurationFetchingStrategy
             @Nonnull final Instant validExpiration, @Nonnull final Instant invalidExpiration,
             @Nonnull final Instant nullExpiration) throws ProtocolException, IOException {
         if (response != null) {
-            if (!HTTP_RESPONSE_CONTENT_TYPE.equals(response.getEntity().getContentType())) {
+            if (!ContentType.create(HTTP_RESPONSE_CONTENT_TYPE).isSameMimeType(
+                    ContentType.parse(response.getEntity().getContentType()))) {
                 log.warn("Unexpected content type: {}", response.getEntity().getContentType());
                 return new EntityConfigurationContainer(entityId, null, validExpiration, invalidExpiration);
             }
diff --git a/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/keyset/DefaultSignedKeysetFetchingStrategy.java b/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/keyset/DefaultSignedKeysetFetchingStrategy.java
index 5b38802..1205f74 100644
--- a/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/keyset/DefaultSignedKeysetFetchingStrategy.java
+++ b/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/keyset/DefaultSignedKeysetFetchingStrategy.java
@@ -25,6 +25,7 @@ import javax.annotation.Nullable;
 import org.apache.hc.client5.http.classic.methods.HttpGet;
 import org.apache.hc.core5.http.ClassicHttpRequest;
 import org.apache.hc.core5.http.ClassicHttpResponse;
+import org.apache.hc.core5.http.ContentType;
 import org.apache.hc.core5.http.ProtocolException;
 import org.apache.hc.core5.http.io.entity.EntityUtils;
 import org.slf4j.Logger;
@@ -103,7 +104,8 @@ public class DefaultSignedKeysetFetchingStrategy
             @Nonnull final Instant validExpiration, @Nonnull final Instant invalidExpiration,
             @Nonnull final Instant nullExpiration) throws ProtocolException, IOException {
         if (response != null) {
-            if (!HTTP_RESPONSE_CONTENT_TYPE.equals(response.getEntity().getContentType())) {
+            if (!ContentType.create(HTTP_RESPONSE_CONTENT_TYPE).isSameMimeType(
+                    ContentType.parse(response.getEntity().getContentType()))) {
                 log.warn("Unexpected content type: {}", response.getEntity().getContentType());
                 return new SignedKeysetContainer(identifier, null, validExpiration, invalidExpiration);
             }
diff --git a/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/resolver/DefaultResolveEntityTrustChainFetchingStrategy.java b/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/resolver/DefaultResolveEntityTrustChainFetchingStrategy.java
index 492976c..28f3051 100644
--- a/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/resolver/DefaultResolveEntityTrustChainFetchingStrategy.java
+++ b/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/resolver/DefaultResolveEntityTrustChainFetchingStrategy.java
@@ -122,7 +122,8 @@ public class DefaultResolveEntityTrustChainFetchingStrategy
             @Nonnull final Instant invalidExpiration, @Nonnull final Instant nullExpiration)
                     throws ProtocolException, IOException {
         if (response != null) {
-            if (!HTTP_RESPONSE_CONTENT_TYPE.equals(response.getEntity().getContentType())) {
+            if (!ContentType.create(HTTP_RESPONSE_CONTENT_TYPE).isSameMimeType(
+                    ContentType.parse(response.getEntity().getContentType()))) {
                 log.warn("Unexpected content type: {}", response.getEntity().getContentType());
                 return new ResolveEntityResponseContainer(identifier, null, validExpiration, invalidExpiration);
             }
diff --git a/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/subordinate/DefaultSubordinateStatementFetchingStrategy.java b/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/subordinate/DefaultSubordinateStatementFetchingStrategy.java
index 3b7c9db..db3a678 100644
--- a/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/subordinate/DefaultSubordinateStatementFetchingStrategy.java
+++ b/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/subordinate/DefaultSubordinateStatementFetchingStrategy.java
@@ -196,7 +196,8 @@ public class DefaultSubordinateStatementFetchingStrategy
             @Nonnull final Instant validExpiration, @Nonnull final Instant invalidExpiration,
             @Nonnull final Instant nullExpiration) throws ProtocolException, IOException {
         if (response != null) {
-            if (!HTTP_RESPONSE_CONTENT_TYPE.equals(response.getEntity().getContentType())) {
+            if (!ContentType.create(HTTP_RESPONSE_CONTENT_TYPE).isSameMimeType(
+                    ContentType.parse(response.getEntity().getContentType()))) {
                 log.warn("Unexpected content type: {}", response.getEntity().getContentType());
                 return new SubordinateStatementContainer(id, null, validExpiration, invalidExpiration);
             }
diff --git a/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/trustmark/DefaultTrustMarkFetchingStrategy.java b/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/trustmark/DefaultTrustMarkFetchingStrategy.java
index 1b6a789..96cfe33 100644
--- a/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/trustmark/DefaultTrustMarkFetchingStrategy.java
+++ b/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/trustmark/DefaultTrustMarkFetchingStrategy.java
@@ -119,7 +119,8 @@ public class DefaultTrustMarkFetchingStrategy
             @Nonnull final Instant validExpiration, @Nonnull final Instant invalidExpiration,
             @Nonnull final Instant nullExpiration) throws ProtocolException, IOException {
         if (response != null) {
-            if (!HTTP_RESPONSE_CONTENT_TYPE.equals(response.getEntity().getContentType())) {
+            if (!ContentType.create(HTTP_RESPONSE_CONTENT_TYPE).isSameMimeType(
+                    ContentType.parse(response.getEntity().getContentType()))) {
                 log.warn("Unexpected content type: {}", response.getEntity().getContentType());
                 return new TrustMarkContainer(request, null, validExpiration, invalidExpiration);
             }
diff --git a/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/trustmark/DefaultTrustMarkStatusFetchingStrategy.java b/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/trustmark/DefaultTrustMarkStatusFetchingStrategy.java
index c107349..e00c573 100644
--- a/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/trustmark/DefaultTrustMarkStatusFetchingStrategy.java
+++ b/oidfed-common-impl/src/main/java/net/shibboleth/oidfed/metadata/cache/trustmark/DefaultTrustMarkStatusFetchingStrategy.java
@@ -105,7 +105,8 @@ public class DefaultTrustMarkStatusFetchingStrategy
             @Nonnull final Instant validExpiration, @Nonnull final Instant invalidExpiration,
             @Nonnull final Instant nullExpiration) throws ProtocolException, IOException {
         if (response != null) {
-            if (!HTTP_RESPONSE_CONTENT_TYPE.equals(response.getEntity().getContentType())) {
+            if (!ContentType.create(HTTP_RESPONSE_CONTENT_TYPE).isSameMimeType(
+                    ContentType.parse(response.getEntity().getContentType()))) {
                 log.warn("Unexpected content type: {}", response.getEntity().getContentType());
                 return new TrustMarkStatusContainer(identifier, null, validExpiration, invalidExpiration);
             }

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


More information about the commits mailing list