[java-idp-plugin-oidc-op-oidfed] 02/03: Replaced the simplest identifier lookup strategies with Spring expressions

Codeberg noreply at shibboleth.net
Fri Jan 30 11:57:12 UTC 2026


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

codeberg pushed a commit to branch dev/CACHE-REFACTOR
in repository java-idp-plugin-oidc-op-oidfed.

View the commit online:
https://codeberg.org/Shibboleth/java-idp-plugin-oidc-op-oidfed/commit/5563351880a061f3e8ce7c14ad1544e25744e2b6

commit 5563351880a061f3e8ce7c14ad1544e25744e2b6
Author: Henri Mikkonen <henri.mikkonen at iki.fi>
AuthorDate: Fri Jan 30 09:08:26 2026 +0200

    Replaced the simplest identifier lookup strategies with Spring expressions
---
 ...IssuerEntityIDCriteriaToIdentifierStrategy.java | 42 ----------------------
 ...ubjectEntityIDCriteriaToIdentifierStrategy.java | 42 ----------------------
 ...eEntityRequestCriteriaToIdentifierStrategy.java | 42 ----------------------
 ...EntityResponseIdentifierExtractionStrategy.java | 38 --------------------
 .../META-INF/net.shibboleth.idp/postconfig.xml     |  5 +--
 .../oidfed/resolve-entity/resolve-entity-beans.xml |  6 ++--
 6 files changed, 7 insertions(+), 168 deletions(-)

diff --git a/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/metadata/cache/DefaultIssuerEntityIDCriteriaToIdentifierStrategy.java b/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/metadata/cache/DefaultIssuerEntityIDCriteriaToIdentifierStrategy.java
deleted file mode 100644
index a6198ce..0000000
--- a/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/metadata/cache/DefaultIssuerEntityIDCriteriaToIdentifierStrategy.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed 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.plugin.oidc.op.oidfed.metadata.cache;
-
-import java.util.function.Function;
-
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.ThreadSafe;
-
-import net.shibboleth.shared.resolver.CriteriaSet;
-
-/**
- * Strategy for extracting an issuer entity ID via {@link IssuerEntityIDCriterion} from a {@link CriteriaSet}.
- */
- at ThreadSafe
-public class DefaultIssuerEntityIDCriteriaToIdentifierStrategy implements Function<CriteriaSet, String> {
-
-    /** {@inheritDoc} */
-    @Override @Nullable
-    public String apply(@Nullable final CriteriaSet criteria) {
-        if (criteria == null) {
-            return null;
-        }
-        final IssuerEntityIDCriterion criterion = criteria.get(IssuerEntityIDCriterion.class);
-        if (criterion != null) {
-            return criterion.getValue();
-        }
-        return null;
-    }
-}
diff --git a/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/metadata/cache/DefaultSubjectEntityIDCriteriaToIdentifierStrategy.java b/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/metadata/cache/DefaultSubjectEntityIDCriteriaToIdentifierStrategy.java
deleted file mode 100644
index 26fea82..0000000
--- a/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/metadata/cache/DefaultSubjectEntityIDCriteriaToIdentifierStrategy.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed 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.plugin.oidc.op.oidfed.metadata.cache;
-
-import java.util.function.Function;
-
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.ThreadSafe;
-
-import net.shibboleth.shared.resolver.CriteriaSet;
-
-/**
- * Strategy for extracting the {@link SubjectEntityIDCriterion} contents from a {@link CriteriaSet}.
- */
- at ThreadSafe
-public class DefaultSubjectEntityIDCriteriaToIdentifierStrategy implements Function<CriteriaSet, String> {
-
-    /** {@inheritDoc} */
-    @Override @Nullable
-    public String apply(@Nullable final CriteriaSet criteria) {
-        if (criteria == null) {
-            return null;
-        }
-        final SubjectEntityIDCriterion criterion = criteria.get(SubjectEntityIDCriterion.class);
-        if (criterion != null) {
-            return criterion.getValue();
-        }
-        return null;
-    }
-}
diff --git a/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/metadata/cache/local/DefaultResolveEntityRequestCriteriaToIdentifierStrategy.java b/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/metadata/cache/local/DefaultResolveEntityRequestCriteriaToIdentifierStrategy.java
deleted file mode 100644
index 81ab3f5..0000000
--- a/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/metadata/cache/local/DefaultResolveEntityRequestCriteriaToIdentifierStrategy.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed 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.plugin.oidc.op.oidfed.metadata.cache.local;
-
-import java.util.Optional;
-import java.util.function.Function;
-
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.ThreadSafe;
-
-import net.shibboleth.shared.resolver.CriteriaSet;
-
-/**
- * Strategy for extracting a resolve entity request as String via {@link ResolveEntityRequestCriterion} from
- * {@link CriteriaSet}.
- */
- at ThreadSafe
-public class DefaultResolveEntityRequestCriteriaToIdentifierStrategy
-    implements Function<CriteriaSet, String> {
-
-    /** {@inheritDoc} */
-    @Override @Nullable
-    public String apply(@Nullable final CriteriaSet criteria) {
-        return Optional.ofNullable(criteria)
-                .map(set -> set.get(ResolveEntityRequestCriterion.class))
-                .map(criterion -> criterion.getRequest())
-                .map(request -> request.toString())
-                .orElse(null);
-    }
-}
diff --git a/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/metadata/cache/local/DefaultResolveEntityResponseIdentifierExtractionStrategy.java b/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/metadata/cache/local/DefaultResolveEntityResponseIdentifierExtractionStrategy.java
deleted file mode 100644
index 8878d6f..0000000
--- a/idp-oidfed-op-impl/src/main/java/net/shibboleth/idp/plugin/oidc/op/oidfed/metadata/cache/local/DefaultResolveEntityResponseIdentifierExtractionStrategy.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed 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.plugin.oidc.op.oidfed.metadata.cache.local;
-
-import java.util.Optional;
-import java.util.function.Function;
-
-import javax.annotation.Nullable;
-import javax.annotation.concurrent.ThreadSafe;
-
-/**
- * Default strategy for extracting request identifier out of {@link ResolveEntityResponseContainer}.
- */
- at ThreadSafe
-public class DefaultResolveEntityResponseIdentifierExtractionStrategy
-        implements Function<ResolveEntityResponseContainer, String> {
-
-    /** {@inheritDoc} */
-    @Override @Nullable
-    public String apply(@Nullable final ResolveEntityResponseContainer responseContainer) {
-        return Optional.ofNullable(responseContainer)
-                .map(container -> container.getRequest())
-                .map(request -> request.toString())
-                .orElse(null);
-    }
-}
\ No newline at end of file
diff --git a/idp-oidfed-op-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml b/idp-oidfed-op-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
index a146e31..af61e8f 100644
--- a/idp-oidfed-op-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
+++ b/idp-oidfed-op-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
@@ -196,7 +196,7 @@
     </bean>
 
     <bean id="shibboleth.oidfed.DefaultSubjectEntityIDCriteriaToIdentifierStrategy"
-        class="net.shibboleth.idp.plugin.oidc.op.oidfed.metadata.cache.DefaultSubjectEntityIDCriteriaToIdentifierStrategy" />
+        parent="shibboleth.Functions.Expression" c:expression="#input?.get(T(net.shibboleth.idp.plugin.oidc.op.oidfed.metadata.cache.SubjectEntityIDCriterion))?.getValue()"/>
 
     <bean id="shibboleth.oidfed.SubordinateEntityStatementMetadataCacheBuilderSpec"
         class="net.shibboleth.oidc.metadata.cache.impl.DynamicMetadataCacheBuilderSpec"
@@ -210,7 +210,8 @@
             <bean class="net.shibboleth.idp.plugin.oidc.op.oidfed.metadata.cache.subordinate.DefaultSubordinateStatementCriteriaToIdentifierStrategy"
                 p:criteriaToSubjectEntityIdStrategy-ref="shibboleth.oidfed.DefaultSubjectEntityIDCriteriaToIdentifierStrategy">
                 <property name="criteriaToIssuerEntityIdStrategy">
-                    <bean class="net.shibboleth.idp.plugin.oidc.op.oidfed.metadata.cache.DefaultIssuerEntityIDCriteriaToIdentifierStrategy"/>
+                    <bean parent="shibboleth.Functions.Expression"
+                        c:expression="#input?.get(T(net.shibboleth.idp.plugin.oidc.op.oidfed.metadata.cache.IssuerEntityIDCriterion))?.getValue()"/>
                 </property>
             </bean>
         </property>
diff --git a/idp-oidfed-op-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oidfed/resolve-entity/resolve-entity-beans.xml b/idp-oidfed-op-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oidfed/resolve-entity/resolve-entity-beans.xml
index 5f1f618..3263d56 100644
--- a/idp-oidfed-op-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oidfed/resolve-entity/resolve-entity-beans.xml
+++ b/idp-oidfed-op-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/oidfed/resolve-entity/resolve-entity-beans.xml
@@ -48,10 +48,12 @@
         p:minCacheDuration="%{idp.oidfed.resolve-entity.maxRefreshDelay:PT1S}"
         p:maxCacheDuration="%{idp.oidfed.resolve-entity.maxRefreshDelay:PT30S}">
         <property name="criteriaToIdentifierStrategy">
-            <bean class="net.shibboleth.idp.plugin.oidc.op.oidfed.metadata.cache.local.DefaultResolveEntityRequestCriteriaToIdentifierStrategy" />
+            <bean parent="shibboleth.Functions.Expression"
+                c:expression="#input?.get(T(net.shibboleth.idp.plugin.oidc.op.oidfed.metadata.cache.local.ResolveEntityRequestCriterion))?.getRequest().toString()"/>
         </property>
         <property name="identifierExtractionStrategy">
-            <bean class="net.shibboleth.idp.plugin.oidc.op.oidfed.metadata.cache.local.DefaultResolveEntityResponseIdentifierExtractionStrategy" />
+            <bean parent="shibboleth.Functions.Expression"
+                c:expression="#input?.getRequest()?.toString()"/>
         </property>
         <property name="metadataExpirationTimeStrategy">
             <bean class="net.shibboleth.idp.plugin.oidc.op.oidfed.metadata.cache.local.DefaultNimbusResponseContainerExpirationTimeStrategy"/>

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


More information about the commits mailing list