[java-idp-oidc] 02/02: JOIDC-284 - Use local/embedded jetty instead of remote Git repository for test data

Codeberg noreply at shibboleth.net
Sun Jul 12 11:08:59 UTC 2026


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

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

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

commit 224d5ae4920312ffcf84b910e5cfed3a829359a5
Author: Henri Mikkonen <henri.mikkonen at iki.fi>
AuthorDate: Sun Jul 12 13:26:05 2026 +0300

    JOIDC-284 - Use local/embedded jetty instead of remote Git repository for test data
    
    https://shibboleth.atlassian.net/browse/JOIDC-284
    
    Switched into using EmbeddedJetty instead of the remote Git repository for test data
    - TODO: Switch into EmbeddedJetty from java-shib-shared/shib-testing once the IdP dependencies are bumped
---
 .../SetRequestObjectToResponseContextTest.java     | 33 ++++++++++++++--------
 .../oidc/op/profile/flow/AuthorizeFlowTest.java    | 22 +++++++++++----
 2 files changed, 39 insertions(+), 16 deletions(-)

diff --git a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/oauth2/profile/impl/SetRequestObjectToResponseContextTest.java b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/oauth2/profile/impl/SetRequestObjectToResponseContextTest.java
index 81c9f2fc..b1215393 100644
--- a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/oauth2/profile/impl/SetRequestObjectToResponseContextTest.java
+++ b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/oauth2/profile/impl/SetRequestObjectToResponseContextTest.java
@@ -15,19 +15,24 @@
 package net.shibboleth.idp.plugin.oidc.op.oauth2.profile.impl;
 
 import net.shibboleth.idp.plugin.oidc.op.profile.impl.BaseOIDCResponseActionTest;
+import net.shibboleth.idp.plugin.oidc.op.testing.EmbeddedJetty;
 import net.shibboleth.idp.profile.testing.ActionTestingSupport;
 import net.shibboleth.oidc.profile.core.OidcEventIds;
 import net.shibboleth.shared.httpclient.HttpClientBuilder;
 import net.shibboleth.shared.httpclient.HttpClientSupport;
-import net.shibboleth.shared.testing.RepositorySupport;
+import net.shibboleth.shared.spring.resource.ResourceHelper;
 
+import java.io.IOException;
+import java.net.SocketException;
 import java.net.URI;
 import java.net.URISyntaxException;
+import java.net.UnknownHostException;
 import java.util.Set;
 import java.util.function.Predicate;
 
 import org.mockito.Mockito;
 import org.opensaml.profile.context.ProfileRequestContext;
+import org.springframework.core.io.ClassPathResource;
 import org.springframework.webflow.execution.Event;
 import org.testng.Assert;
 import org.testng.annotations.BeforeMethod;
@@ -47,7 +52,7 @@ public class SetRequestObjectToResponseContextTest extends BaseOIDCResponseActio
 
     /** Action. */
     private SetRequestObjectToResponseContext action;
-    
+
     @SuppressWarnings("unchecked")
     private Predicate<ProfileRequestContext> enforceRequestObjects = Mockito.mock(Predicate.class);
 
@@ -126,14 +131,11 @@ public class SetRequestObjectToResponseContextTest extends BaseOIDCResponseActio
      * 
      * @throws URISyntaxException
      * @throws ParseException 
+     * @throws IOException 
      */
     @Test
-    public void testRequestURI() throws URISyntaxException, ParseException {
-        
-        // TODO: Use helper method again once we refresh IdP baseline
-        //final String uri = RepositorySupport.buildHTTPSResourceURL("java-idp-oidc", "idp-oidc-extension-impl/src/test/resources/net/shibboleth/idp/oidc/profile/impl/oidc-authreq.json");
-        String uri = "https://test.shibboleth.net/unittests/java-idp-oidc/HEAD/idp-oidc-extension-impl/src/test/resources/net/shibboleth/idp/oidc/profile/impl/oidc-authreq.json";
-        
+    public void testRequestURI() throws URISyntaxException, ParseException, IOException {
+        final String uri = "https://localhost:8443/oidc-austhreq.json";
         assert metadataCtx != null;
         final OIDCClientInformation clientInformation = metadataCtx.getClientInformation();
         assert clientInformation != null;
@@ -142,10 +144,19 @@ public class SetRequestObjectToResponseContextTest extends BaseOIDCResponseActio
         setAuthenticationRequest(
                 AuthenticationRequest.parse("client_id=" + clientId +
                         "&request_uri=" + UrlEscapers.urlFormParameterEscaper().escape(uri)));
-        final Event event = action.execute(requestCtx);
-        ActionTestingSupport.assertProceedEvent(event);
+
+        //TODO switch into EmbeddedJetty from java-shib-shared once IdP dependencies are bumped
+        try (final EmbeddedJetty jetty = new EmbeddedJetty()) {
+            jetty.startServer(new EmbeddedJetty.ResourceHandler(200, ResourceHelper.of(
+                    new ClassPathResource("net/shibboleth/idp/oidc/profile/impl/oidc-authreq.json"))));
+            final Event event = action.execute(requestCtx);
+            ActionTestingSupport.assertProceedEvent(event);
+            jetty.stopServer();
+        } catch (final UnknownHostException | SocketException e) {
+            Assert.fail("Embedded Jetty failed", e);
+        }
         Assert.assertNotNull(respCtx.getRequestObject());
         Assert.assertTrue(respCtx.getRequestObject() instanceof SignedJWT);
     }
     
-}
\ No newline at end of file
+}
diff --git a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/flow/AuthorizeFlowTest.java b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/flow/AuthorizeFlowTest.java
index 2bbd6b4b..d45b8819 100644
--- a/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/flow/AuthorizeFlowTest.java
+++ b/idp-oidc-extension-impl/src/test/java/net/shibboleth/idp/plugin/oidc/op/profile/flow/AuthorizeFlowTest.java
@@ -16,9 +16,11 @@ package net.shibboleth.idp.plugin.oidc.op.profile.flow;
 
 import java.io.IOException;
 import java.io.UnsupportedEncodingException;
+import java.net.SocketException;
 import java.net.URI;
 import java.net.URISyntaxException;
 import java.net.URLEncoder;
+import java.net.UnknownHostException;
 import java.security.NoSuchAlgorithmException;
 import java.security.PublicKey;
 import java.security.interfaces.RSAPublicKey;
@@ -34,6 +36,7 @@ import java.util.Set;
 import org.opensaml.storage.StorageService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.core.io.ClassPathResource;
 import org.springframework.mock.web.MockHttpServletRequest;
 import org.springframework.webflow.executor.FlowExecutionResult;
 import org.testng.Assert;
@@ -66,6 +69,7 @@ import com.nimbusds.openid.connect.sdk.claims.IDTokenClaimsSet;
 import com.nimbusds.openid.connect.sdk.rp.OIDCClientMetadata;
 
 import net.shibboleth.idp.plugin.oidc.op.profile.logic.DefaultPushedAuthorizationRequestUriSerializationFunction;
+import net.shibboleth.idp.plugin.oidc.op.testing.EmbeddedJetty;
 import net.shibboleth.idp.plugin.oidc.op.token.support.AccessTokenClaimsSet;
 import net.shibboleth.idp.plugin.oidc.op.token.support.AuthorizeCodeClaimsSet;
 import net.shibboleth.idp.session.SessionException;
@@ -73,7 +77,7 @@ import net.shibboleth.oidc.profile.core.OidcError;
 import net.shibboleth.shared.collection.Pair;
 import net.shibboleth.shared.component.ComponentInitializationException;
 import net.shibboleth.shared.security.DataSealerException;
-import net.shibboleth.shared.testing.RepositorySupport;
+import net.shibboleth.shared.spring.resource.ResourceHelper;
 
 /**
  * Tests for the authorize-flow.
@@ -283,9 +287,9 @@ public class AuthorizeFlowTest extends AbstractOidcFlowTest {
     @Test
     public void testWithAuthorizationCodeFlow_parRequiredByProfileUriProvided() throws IOException, SessionException,
             URISyntaxException {
+
         final String clientId = "s6BhdRkqt3";
-        final String uri = RepositorySupport.buildHTTPSResourceURL("java-idp-oidc",
-                "idp-oidc-extension-impl/src/test/resources/net/shibboleth/idp/oidc/profile/impl/oidc-authreq.json");
+        final String uri = "https://localhost:8443/oidc-austhreq.json";
         setRequestParameters(List.of(new Pair<>("client_id", clientId),
                 new Pair<>("response_type", "code"),
                 new Pair<>("scope", "openid profile"),
@@ -299,8 +303,16 @@ public class AuthorizeFlowTest extends AbstractOidcFlowTest {
 
         initializeThreadLocals();
         
-        final FlowExecutionResult result = flowExecutor.launchExecution(FLOW_ID, null, externalContext);
-        Assert.assertEquals("ErrorView", result.getOutcome().getId());
+        //TODO switch into EmbeddedJetty from java-shib-shared once IdP dependencies are bumped
+        try (final EmbeddedJetty jetty = new EmbeddedJetty()) {
+            jetty.startServer(new EmbeddedJetty.ResourceHandler(200, ResourceHelper.of(
+                    new ClassPathResource("net/shibboleth/idp/oidc/profile/impl/oidc-authreq.json"))));
+            final FlowExecutionResult result = flowExecutor.launchExecution(FLOW_ID, null, externalContext);
+            Assert.assertEquals("ErrorView", result.getOutcome().getId());
+            jetty.stopServer();
+        } catch (final UnknownHostException | SocketException e) {
+            Assert.fail("Embedded Jetty failed", e);
+        }
         removeMetadata(storageService, clientId);
     }
 

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


More information about the commits mailing list