[java-plugin-shibd-oidc] branch main updated: Change resource lookup to a List
Phil Smart
philip.smart at jisc.ac.uk
Fri Oct 10 16:17:57 UTC 2025
This is an automated email from the git hooks/post-receive script.
philsmart pushed a commit to branch main
in repository java-plugin-shibd-oidc.
View the commit online:
http://git.shibboleth.net/view/?p=java-plugin-shibd-oidc.git;a=commit;h=dbf170a77de7911f761097637e481bc9634751fb
The following commit(s) were added to refs/heads/main by this push:
new dbf170a Change resource lookup to a List
dbf170a is described below
commit dbf170a77de7911f761097637e481bc9634751fb
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Fri Oct 10 17:17:55 2025 +0100
Change resource lookup to a List
---
.../sp/oidc/profile/impl/ResourceLookupStrategy.java | 18 +++++++++---------
.../oidc/profile/request/impl/AddResourceHandler.java | 8 ++++----
.../oidc/profile/impl/ResourceLookupStrategyTest.java | 18 +++++++++---------
3 files changed, 22 insertions(+), 22 deletions(-)
diff --git a/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/ResourceLookupStrategy.java b/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/ResourceLookupStrategy.java
index 169ccdf..2c23690 100644
--- a/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/ResourceLookupStrategy.java
+++ b/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/impl/ResourceLookupStrategy.java
@@ -16,8 +16,8 @@ package net.shibboleth.sp.oidc.profile.impl;
import java.net.URI;
import java.net.URISyntaxException;
+import java.util.List;
import java.util.Objects;
-import java.util.Set;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
@@ -41,33 +41,33 @@ import net.shibboleth.sp.oidc.profile.OIDCInitiatorConstants;
* <p>Validation ensures the URIs are absolute and do not contain a fragment component, per RFC. Any that aren't
* are filtered out.</p>
*/
-public class ResourceLookupStrategy extends AbstractAgentAndRelyingPartyContextLookupFunction<Set<URI>>{
+public class ResourceLookupStrategy extends AbstractAgentAndRelyingPartyContextLookupFunction<List<URI>>{
/** Logger. */
@Nonnull private final Logger log = LoggerFactory.getLogger(ResourceLookupStrategy.class);
/** {@inheritDoc} */
@Override
- public Set<URI> apply(final MessageContext messageContext) {
+ public List<URI> apply(final MessageContext messageContext) {
final DDF input = getDDF(messageContext, DDFDirection.INPUT);
if (input == null) {
- return CollectionSupport.emptySet();
+ return CollectionSupport.emptyList();
}
final OIDCAuthenticationRelyingPartyProfileConfiguration rpConfig =
getOIDCRelyingPartyProfileConfiguration(messageContext);
- Set<String> resources = input.getmember(OIDCInitiatorConstants.RESOURCE).asList().stream()
+ List<String> resources = input.getmember(OIDCInitiatorConstants.RESOURCE).asList().stream()
.map(DDF::string)
- .collect(CollectionSupport.nonnullCollector(Collectors.toUnmodifiableSet())).get();
+ .collect(CollectionSupport.nonnullCollector(Collectors.toUnmodifiableList())).get();
if (!resources.isEmpty() && isFeatureDisallowed(OIDCAuthorizationConfiguration.FEATURE_RESOURCE_INDICATOR,
messageContext)) {
log.warn("Agent disallowed from overriding resource indicators");
- resources = CollectionSupport.emptySet();
+ resources = CollectionSupport.emptyList();
}
if (rpConfig != null && resources.isEmpty()) {
- final Set<String> profileResources = rpConfig.getResourceIndicators(PRC_LOOKUP.apply(messageContext));
+ final List<String> profileResources = rpConfig.getResourceIndicators(PRC_LOOKUP.apply(messageContext));
if (profileResources != null) {
resources = profileResources;
}
@@ -94,7 +94,7 @@ public class ResourceLookupStrategy extends AbstractAgentAndRelyingPartyContextL
}
return true;
})
- .collect(CollectionSupport.nonnullCollector(Collectors.toUnmodifiableSet())).get();
+ .collect(CollectionSupport.nonnullCollector(Collectors.toUnmodifiableList())).get();
}
diff --git a/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/request/impl/AddResourceHandler.java b/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/request/impl/AddResourceHandler.java
index a3ee739..5810456 100644
--- a/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/request/impl/AddResourceHandler.java
+++ b/sp-oidc-impl/src/main/java/net/shibboleth/sp/oidc/profile/request/impl/AddResourceHandler.java
@@ -15,7 +15,7 @@
package net.shibboleth.sp.oidc.profile.request.impl;
import java.net.URI;
-import java.util.Set;
+import java.util.List;
import javax.annotation.Nonnull;
@@ -30,7 +30,7 @@ import net.shibboleth.sp.oidc.profile.impl.AbstractAuthenticationRequestParamete
/**
* A message handler that adds OAuth 2.0 resource indicators to the authentication request.
*/
-public class AddResourceHandler extends AbstractAuthenticationRequestParameterValueMessageHandler<Set<URI>> {
+public class AddResourceHandler extends AbstractAuthenticationRequestParameterValueMessageHandler<List<URI>> {
/** Class logger. */
@Nonnull private final Logger log = LoggerFactory.getLogger(AddResourceHandler.class);
@@ -40,13 +40,13 @@ public class AddResourceHandler extends AbstractAuthenticationRequestParameterVa
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
protected AddResourceHandler() {
- super((Class)Set.class);
+ super((Class)List.class);
}
@Override
protected void doInvoke(@Nonnull final MessageContext messageContext)
throws MessageHandlerException {
- final Set<URI> resources = getParameterValue(messageContext);
+ final List<URI> resources = getParameterValue(messageContext);
log.debug("{} Adding resource indicators '{}'", getLogPrefix(), resources);
getAuthenticationRequest().setResources(resources);
diff --git a/sp-oidc-impl/src/test/java/net/shibboleth/sp/oidc/profile/impl/ResourceLookupStrategyTest.java b/sp-oidc-impl/src/test/java/net/shibboleth/sp/oidc/profile/impl/ResourceLookupStrategyTest.java
index 43a5e2b..50722b5 100644
--- a/sp-oidc-impl/src/test/java/net/shibboleth/sp/oidc/profile/impl/ResourceLookupStrategyTest.java
+++ b/sp-oidc-impl/src/test/java/net/shibboleth/sp/oidc/profile/impl/ResourceLookupStrategyTest.java
@@ -19,7 +19,7 @@ import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
import java.net.URI;
-import java.util.Set;
+import java.util.List;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -62,7 +62,7 @@ public class ResourceLookupStrategyTest extends AbstractAuthenticationLookupStra
resourceList.add(new DDF(null).string("https://cal.example.com"));
resourceList.add(new DDF(null).string("https://mail.example.com"));
- final Set<URI> result = strategy.apply(mc);
+ final List<URI> result = strategy.apply(mc);
assertNotNull(result);
assert result != null;
assertEquals(result.size(), 2);
@@ -75,7 +75,7 @@ public class ResourceLookupStrategyTest extends AbstractAuthenticationLookupStra
resourceList.add(new DDF(null).string("https://cal.example.com"));
rpConfig.setDisallowedFeatures(OIDCAuthorizationConfiguration.FEATURE_RESOURCE_INDICATOR);
- final Set<URI> result = strategy.apply(mc);
+ final List<URI> result = strategy.apply(mc);
assertTrue(result.isEmpty());
}
@@ -84,7 +84,7 @@ public class ResourceLookupStrategyTest extends AbstractAuthenticationLookupStra
final DDF resourceList = ddf.addmember(OIDCInitiatorConstants.RESOURCE).list();
resourceList.add(new DDF(null).string("invalid"));
- final Set<URI> result = strategy.apply(mc);
+ final List<URI> result = strategy.apply(mc);
assertTrue(result.isEmpty());
}
@@ -93,7 +93,7 @@ public class ResourceLookupStrategyTest extends AbstractAuthenticationLookupStra
final DDF resourceList = ddf.addmember(OIDCInitiatorConstants.RESOURCE).list();
resourceList.add(new DDF(null).string("/calendar"));
- final Set<URI> result = strategy.apply(mc);
+ final List<URI> result = strategy.apply(mc);
assertTrue(result.isEmpty());
}
@@ -102,16 +102,16 @@ public class ResourceLookupStrategyTest extends AbstractAuthenticationLookupStra
final DDF resourceList = ddf.addmember(OIDCInitiatorConstants.RESOURCE).list();
resourceList.add(new DDF(null).string("https://cal.example.com/test#fragment"));
- final Set<URI> result = strategy.apply(mc);
+ final List<URI> result = strategy.apply(mc);
assertTrue(result.isEmpty());
}
@Test
public void testApply_UsesProfileResourcesWhenInputEmpty() {
- rpConfig.setResourceIndicators(Set.of("https://cal.example.com/"));
+ rpConfig.setResourceIndicators(List.of("https://cal.example.com/"));
- final Set<URI> result = strategy.apply(mc);
- assertEquals(result.size(), 0);
+ final List<URI> result = strategy.apply(mc);
+ assertEquals(result.size(), 1);
}
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list