[java-identity-provider] 04/05: IDP-1793 Use Suppliers for HttpRequest/Response
Rod Widdowson
rdw at steadingsoftware.com
Sun Aug 14 09:30:34 UTC 2022
This is an automated email from the git hooks/post-receive script.
rdw pushed a commit to branch main
in repository java-identity-provider.
View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=c6df351cda32abcae034a6d621f7b02998a1fe7a
commit c6df351cda32abcae034a6d621f7b02998a1fe7a
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sat Jul 30 11:13:43 2022 +0100
IDP-1793 Use Suppliers for HttpRequest/Response
https://shibboleth.atlassian.net/browse/IDP-1793
AbstractProfileAction now has a setter for Suppliers for
HttpServletRequest & Repsonse
Make the tests use them
---
.../idp/admin/impl/DoStorageOperationTest.java | 6 ++--
...ializeAdministrativeProfileContextTreeTest.java | 6 +++-
.../ExtractDuoAuthenticationFromHeadersTest.java | 10 ++++--
.../idp/authn/impl/ExtractRemoteUserTest.java | 8 +++--
.../authn/impl/ExtractUserAgentAddressTest.java | 18 +++++++----
.../authn/impl/ExtractUserAgentIdentifierTest.java | 18 +++++++----
.../ExtractUsernamePasswordFromBasicAuthTest.java | 6 +++-
...ExtractUsernamePasswordFromFormRequestTest.java | 18 +++++++----
.../ExtractX509CertificateFromRequestTest.java | 19 ++++++-----
.../impl/HTPasswdCredentialValidatorTest.java | 23 ++++++++------
.../authn/impl/JAASCredentialValidatorTest.java | 35 ++++++++++----------
.../authn/impl/LDAPCredentialValidatorTest.java | 35 ++++++++++----------
.../impl/PreserveAuthenticationFlowStateTest.java | 18 +++++++----
.../idp/authn/impl/ValidateCredentialsTest.java | 33 ++++++++++---------
.../impl/ValidateExternalAuthenticationTest.java | 5 ++-
.../idp/authn/impl/ValidateRemoteUserTest.java | 6 ++--
.../authn/impl/ValidateUserAgentAddressTest.java | 19 ++++++-----
.../X509CertificateCredentialValidatorTest.java | 19 ++++++-----
.../proxy/impl/ExtractDiscoveryResponseTest.java | 16 ++++++----
.../idp/consent/flow/impl/ExtractConsentTest.java | 18 +++++++----
.../idp/profile/audit/impl/WriteAuditLogTest.java | 17 +++++-----
.../AddAuthenticationStatementToAssertionTest.java | 35 ++++++++++----------
.../impl/AddAuthnStatementToAssertionTest.java | 37 +++++++++++-----------
.../ProcessAssertionsForAuthenticationTest.java | 7 ++--
.../session/impl/PopulateSessionContextTest.java | 33 ++++++++++---------
.../idp/session/impl/ProcessLogoutTest.java | 34 ++++++++++----------
26 files changed, 290 insertions(+), 209 deletions(-)
diff --git a/idp-admin-impl/src/test/java/net/shibboleth/idp/admin/impl/DoStorageOperationTest.java b/idp-admin-impl/src/test/java/net/shibboleth/idp/admin/impl/DoStorageOperationTest.java
index a710cc415..68a89abcb 100644
--- a/idp-admin-impl/src/test/java/net/shibboleth/idp/admin/impl/DoStorageOperationTest.java
+++ b/idp-admin-impl/src/test/java/net/shibboleth/idp/admin/impl/DoStorageOperationTest.java
@@ -21,9 +21,11 @@ import java.io.IOException;
import java.text.ParseException;
import java.time.Duration;
import java.util.Map;
+import java.util.function.Supplier;
import javax.annotation.Nonnull;
import jakarta.servlet.http.HttpServletResponse;
+import jakarta.servlet.http.HttpServletRequest;
import org.joda.time.Instant;
import org.opensaml.storage.StorageRecord;
@@ -89,8 +91,8 @@ public class DoStorageOperationTest {
mapper.setSerializationInclusion(Include.NON_NULL);
action = new DoStorageOperation();
- action.setHttpServletRequest(request);
- action.setHttpServletResponse(response);
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletResponseSupplier(new Supplier<> () {public HttpServletResponse get() {return response;}});
action.setStorageService(storageService);
action.setObjectMapper(mapper);
action.initialize();
diff --git a/idp-admin-impl/src/test/java/net/shibboleth/idp/admin/impl/InitializeAdministrativeProfileContextTreeTest.java b/idp-admin-impl/src/test/java/net/shibboleth/idp/admin/impl/InitializeAdministrativeProfileContextTreeTest.java
index 15e04e511..715f49119 100644
--- a/idp-admin-impl/src/test/java/net/shibboleth/idp/admin/impl/InitializeAdministrativeProfileContextTreeTest.java
+++ b/idp-admin-impl/src/test/java/net/shibboleth/idp/admin/impl/InitializeAdministrativeProfileContextTreeTest.java
@@ -18,6 +18,7 @@
package net.shibboleth.idp.admin.impl;
import java.util.Collections;
+import java.util.function.Supplier;
import org.opensaml.core.testing.OpenSAMLInitBaseTestCase;
import org.opensaml.profile.context.ProfileRequestContext;
@@ -65,7 +66,10 @@ public class InitializeAdministrativeProfileContextTreeTest extends OpenSAMLInit
action = new InitializeAdministrativeProfileContextTree();
action.setAdministrativeFlowDescriptor(descriptor);
- action.setHttpServletRequest((HttpServletRequest) src.getExternalContext().getNativeRequest());
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() {
+ return (HttpServletRequest) src.getExternalContext().getNativeRequest();
+ }
+ });
action.initialize();
}
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/duo/impl/ExtractDuoAuthenticationFromHeadersTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/duo/impl/ExtractDuoAuthenticationFromHeadersTest.java
index 66aa0e182..b677d6256 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/duo/impl/ExtractDuoAuthenticationFromHeadersTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/duo/impl/ExtractDuoAuthenticationFromHeadersTest.java
@@ -26,6 +26,10 @@ import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
import net.shibboleth.idp.profile.testing.ActionTestingSupport;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+import java.util.function.Supplier;
+
+import jakarta.servlet.http.HttpServletRequest;
+
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.webflow.execution.Event;
import org.testng.Assert;
@@ -41,7 +45,8 @@ public class ExtractDuoAuthenticationFromHeadersTest extends BaseAuthenticationC
super.setUp();
action = new ExtractDuoAuthenticationFromHeaders();
- action.setHttpServletRequest(new MockHttpServletRequest());
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
action.initialize();
}
@@ -60,7 +65,8 @@ public class ExtractDuoAuthenticationFromHeadersTest extends BaseAuthenticationC
@Test public void testNoAuto() throws ComponentInitializationException {
action = new ExtractDuoAuthenticationFromHeaders();
- action.setHttpServletRequest(new MockHttpServletRequest());
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
action.setAutoAuthenticationSupported(false);
action.initialize();
final Event event = action.execute(src);
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractRemoteUserTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractRemoteUserTest.java
index e983ceed9..6ee8dcab4 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractRemoteUserTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractRemoteUserTest.java
@@ -19,6 +19,9 @@ package net.shibboleth.idp.authn.impl;
import java.util.Arrays;
+import java.util.function.Supplier;
+
+import jakarta.servlet.http.HttpServletRequest;
import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.authn.context.AuthenticationContext;
@@ -43,7 +46,8 @@ public class ExtractRemoteUserTest extends BaseAuthenticationContextTest {
super.setUp();
action = new ExtractRemoteUser();
- action.setHttpServletRequest(new MockHttpServletRequest());
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
}
@Test public void testNoConfig() {
@@ -57,7 +61,7 @@ public class ExtractRemoteUserTest extends BaseAuthenticationContextTest {
}
@Test public void testNoServlet() throws ComponentInitializationException {
- action.setHttpServletRequest(null);
+ action.setHttpServletRequestSupplier(null);
action.initialize();
final Event event = action.execute(src);
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUserAgentAddressTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUserAgentAddressTest.java
index a93ee65fa..6bbdcc1df 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUserAgentAddressTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUserAgentAddressTest.java
@@ -18,12 +18,7 @@
package net.shibboleth.idp.authn.impl;
-import net.shibboleth.idp.authn.AuthnEventIds;
-import net.shibboleth.idp.authn.context.AuthenticationContext;
-import net.shibboleth.idp.authn.context.UserAgentContext;
-import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
-import net.shibboleth.idp.profile.testing.ActionTestingSupport;
-import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+import java.util.function.Supplier;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.webflow.execution.Event;
@@ -31,6 +26,14 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import jakarta.servlet.http.HttpServletRequest;
+import net.shibboleth.idp.authn.AuthnEventIds;
+import net.shibboleth.idp.authn.context.AuthenticationContext;
+import net.shibboleth.idp.authn.context.UserAgentContext;
+import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
+import net.shibboleth.idp.profile.testing.ActionTestingSupport;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+
/** {@link ExtractUserAgentAddress} unit test. */
public class ExtractUserAgentAddressTest extends BaseAuthenticationContextTest {
@@ -40,7 +43,8 @@ public class ExtractUserAgentAddressTest extends BaseAuthenticationContextTest {
super.setUp();
action = new ExtractUserAgentAddress();
- action.setHttpServletRequest(new MockHttpServletRequest());
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
action.initialize();
}
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUserAgentIdentifierTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUserAgentIdentifierTest.java
index 654ea9546..a9a29885d 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUserAgentIdentifierTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUserAgentIdentifierTest.java
@@ -18,12 +18,7 @@
package net.shibboleth.idp.authn.impl;
-import net.shibboleth.idp.authn.AuthnEventIds;
-import net.shibboleth.idp.authn.context.AuthenticationContext;
-import net.shibboleth.idp.authn.context.UserAgentContext;
-import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
-import net.shibboleth.idp.profile.testing.ActionTestingSupport;
-import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+import java.util.function.Supplier;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.webflow.execution.Event;
@@ -31,6 +26,14 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import jakarta.servlet.http.HttpServletRequest;
+import net.shibboleth.idp.authn.AuthnEventIds;
+import net.shibboleth.idp.authn.context.AuthenticationContext;
+import net.shibboleth.idp.authn.context.UserAgentContext;
+import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
+import net.shibboleth.idp.profile.testing.ActionTestingSupport;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+
/** {@link ExtractUserAgentIdentifier} unit test. */
public class ExtractUserAgentIdentifierTest extends BaseAuthenticationContextTest {
@@ -40,7 +43,8 @@ public class ExtractUserAgentIdentifierTest extends BaseAuthenticationContextTes
super.setUp();
action = new ExtractUserAgentIdentifier();
- action.setHttpServletRequest(new MockHttpServletRequest());
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
action.initialize();
}
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUsernamePasswordFromBasicAuthTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUsernamePasswordFromBasicAuthTest.java
index 7572ac17c..c965780de 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUsernamePasswordFromBasicAuthTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUsernamePasswordFromBasicAuthTest.java
@@ -18,6 +18,8 @@
package net.shibboleth.idp.authn.impl;
+import java.util.function.Supplier;
+
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.webflow.execution.Event;
import org.testng.Assert;
@@ -26,6 +28,7 @@ import org.testng.annotations.Test;
import com.google.common.net.HttpHeaders;
+import jakarta.servlet.http.HttpServletRequest;
import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.idp.authn.context.UsernamePasswordContext;
@@ -42,7 +45,8 @@ public class ExtractUsernamePasswordFromBasicAuthTest extends BaseAuthentication
super.setUp();
action = new ExtractUsernamePasswordFromBasicAuth();
- action.setHttpServletRequest(new MockHttpServletRequest());
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}}); action.initialize();
action.initialize();
}
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUsernamePasswordFromFormRequestTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUsernamePasswordFromFormRequestTest.java
index 8f5f88b13..e5e6b4406 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUsernamePasswordFromFormRequestTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractUsernamePasswordFromFormRequestTest.java
@@ -18,12 +18,7 @@
package net.shibboleth.idp.authn.impl;
-import net.shibboleth.idp.authn.AuthnEventIds;
-import net.shibboleth.idp.authn.context.AuthenticationContext;
-import net.shibboleth.idp.authn.context.UsernamePasswordContext;
-import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
-import net.shibboleth.idp.profile.testing.ActionTestingSupport;
-import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+import java.util.function.Supplier;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.webflow.execution.Event;
@@ -31,6 +26,14 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import jakarta.servlet.http.HttpServletRequest;
+import net.shibboleth.idp.authn.AuthnEventIds;
+import net.shibboleth.idp.authn.context.AuthenticationContext;
+import net.shibboleth.idp.authn.context.UsernamePasswordContext;
+import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
+import net.shibboleth.idp.profile.testing.ActionTestingSupport;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+
/** {@link ExtractUsernamePasswordFromFormRequest} unit test. */
public class ExtractUsernamePasswordFromFormRequestTest extends BaseAuthenticationContextTest {
@@ -42,7 +45,8 @@ public class ExtractUsernamePasswordFromFormRequestTest extends BaseAuthenticati
action = new ExtractUsernamePasswordFromFormRequest();
action.setUsernameFieldName("j_username");
action.setPasswordFieldName("j_password");
- action.setHttpServletRequest(new MockHttpServletRequest());
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
action.initialize();
}
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractX509CertificateFromRequestTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractX509CertificateFromRequestTest.java
index 61146ca88..6aad640a1 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractX509CertificateFromRequestTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ExtractX509CertificateFromRequestTest.java
@@ -20,13 +20,7 @@ package net.shibboleth.idp.authn.impl;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
-
-import net.shibboleth.idp.authn.AuthnEventIds;
-import net.shibboleth.idp.authn.context.AuthenticationContext;
-import net.shibboleth.idp.authn.context.CertificateContext;
-import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
-import net.shibboleth.idp.profile.testing.ActionTestingSupport;
-import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+import java.util.function.Supplier;
import org.opensaml.security.x509.X509Support;
import org.springframework.mock.web.MockHttpServletRequest;
@@ -35,6 +29,14 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import jakarta.servlet.http.HttpServletRequest;
+import net.shibboleth.idp.authn.AuthnEventIds;
+import net.shibboleth.idp.authn.context.AuthenticationContext;
+import net.shibboleth.idp.authn.context.CertificateContext;
+import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
+import net.shibboleth.idp.profile.testing.ActionTestingSupport;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+
/** {@link ExtractX509CertificateFromRequest} unit test. */
public class ExtractX509CertificateFromRequestTest extends BaseAuthenticationContextTest {
@@ -89,7 +91,8 @@ public class ExtractX509CertificateFromRequestTest extends BaseAuthenticationCon
super.setUp();
action = new ExtractX509CertificateFromRequest();
- action.setHttpServletRequest(new MockHttpServletRequest());
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
action.initialize();
}
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/HTPasswdCredentialValidatorTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/HTPasswdCredentialValidatorTest.java
index f808ca7be..2c096c378 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/HTPasswdCredentialValidatorTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/HTPasswdCredentialValidatorTest.java
@@ -22,10 +22,20 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
+import java.util.function.Supplier;
import java.util.regex.Pattern;
import javax.security.auth.login.LoginException;
+import org.springframework.core.io.ClassPathResource;
+import org.springframework.core.io.FileSystemResource;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.webflow.execution.Event;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import jakarta.servlet.http.HttpServletRequest;
import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.idp.authn.context.AuthenticationErrorContext;
@@ -38,14 +48,6 @@ import net.shibboleth.idp.authn.testing.TestPrincipal;
import net.shibboleth.idp.profile.testing.ActionTestingSupport;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-import org.springframework.core.io.ClassPathResource;
-import org.springframework.core.io.FileSystemResource;
-import org.springframework.mock.web.MockHttpServletRequest;
-import org.springframework.webflow.execution.Event;
-import org.testng.Assert;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
/** Unit test for htpasswd file validation. */
public class HTPasswdCredentialValidatorTest extends BaseAuthenticationContextTest {
@@ -70,7 +72,8 @@ public class HTPasswdCredentialValidatorTest extends BaseAuthenticationContextTe
mappings.put(AuthnEventIds.UNKNOWN_USERNAME, Collections.singleton(AuthnEventIds.UNKNOWN_USERNAME));
action.setClassifiedMessages(mappings);
- action.setHttpServletRequest(new MockHttpServletRequest());
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
}
@Test public void testMissingFlow() throws ComponentInitializationException {
@@ -326,7 +329,7 @@ public class HTPasswdCredentialValidatorTest extends BaseAuthenticationContextTe
private void doExtract() throws ComponentInitializationException {
final ExtractUsernamePasswordFromFormRequest extract = new ExtractUsernamePasswordFromFormRequest();
- extract.setHttpServletRequest(action.getHttpServletRequest());
+ extract.setHttpServletRequestSupplier(action.getHttpServletRequestSupplier());
extract.initialize();
extract.execute(src);
}
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/JAASCredentialValidatorTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/JAASCredentialValidatorTest.java
index 966162686..c6992e937 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/JAASCredentialValidatorTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/JAASCredentialValidatorTest.java
@@ -26,24 +26,11 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
+import java.util.function.Supplier;
import java.util.regex.Pattern;
import javax.security.auth.login.LoginException;
-import net.shibboleth.idp.authn.AuthnEventIds;
-import net.shibboleth.idp.authn.context.AuthenticationContext;
-import net.shibboleth.idp.authn.context.AuthenticationErrorContext;
-import net.shibboleth.idp.authn.context.RequestedPrincipalContext;
-import net.shibboleth.idp.authn.context.UsernamePasswordContext;
-import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
-import net.shibboleth.idp.authn.principal.UsernamePrincipal;
-import net.shibboleth.idp.authn.principal.impl.ExactPrincipalEvalPredicateFactory;
-import net.shibboleth.idp.authn.testing.TestPrincipal;
-import net.shibboleth.idp.profile.testing.ActionTestingSupport;
-import net.shibboleth.utilities.java.support.collection.Pair;
-import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-import net.shibboleth.utilities.java.support.net.URISupport;
-
import org.springframework.core.io.ClassPathResource;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.webflow.execution.Event;
@@ -58,6 +45,21 @@ import com.unboundid.ldap.listener.InMemoryDirectoryServerConfig;
import com.unboundid.ldap.listener.InMemoryListenerConfig;
import com.unboundid.ldap.sdk.LDAPException;
+import jakarta.servlet.http.HttpServletRequest;
+import net.shibboleth.idp.authn.AuthnEventIds;
+import net.shibboleth.idp.authn.context.AuthenticationContext;
+import net.shibboleth.idp.authn.context.AuthenticationErrorContext;
+import net.shibboleth.idp.authn.context.RequestedPrincipalContext;
+import net.shibboleth.idp.authn.context.UsernamePasswordContext;
+import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
+import net.shibboleth.idp.authn.principal.UsernamePrincipal;
+import net.shibboleth.idp.authn.principal.impl.ExactPrincipalEvalPredicateFactory;
+import net.shibboleth.idp.authn.testing.TestPrincipal;
+import net.shibboleth.idp.profile.testing.ActionTestingSupport;
+import net.shibboleth.utilities.java.support.collection.Pair;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+import net.shibboleth.utilities.java.support.net.URISupport;
+
/** Unit test for JAAS validation. */
public class JAASCredentialValidatorTest extends BaseAuthenticationContextTest {
@@ -107,7 +109,8 @@ public class JAASCredentialValidatorTest extends BaseAuthenticationContextTest {
mappings.put("InvalidPassword", Collections.singleton("INVALID_CREDENTIALS"));
action.setClassifiedMessages(mappings);
- action.setHttpServletRequest(new MockHttpServletRequest());
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
}
@Test public void testMissingFlow() throws ComponentInitializationException {
@@ -403,7 +406,7 @@ public class JAASCredentialValidatorTest extends BaseAuthenticationContextTest {
private void doExtract() throws ComponentInitializationException {
final ExtractUsernamePasswordFromFormRequest extract = new ExtractUsernamePasswordFromFormRequest();
- extract.setHttpServletRequest(action.getHttpServletRequest());
+ extract.setHttpServletRequestSupplier(action.getHttpServletRequestSupplier());
extract.initialize();
extract.execute(src);
}
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/LDAPCredentialValidatorTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/LDAPCredentialValidatorTest.java
index b7b491521..475e90d47 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/LDAPCredentialValidatorTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/LDAPCredentialValidatorTest.java
@@ -24,22 +24,9 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
+import java.util.function.Supplier;
import java.util.regex.Pattern;
-import net.shibboleth.idp.authn.AuthenticationResult;
-import net.shibboleth.idp.authn.AuthnEventIds;
-import net.shibboleth.idp.authn.TemplateSearchDnResolver;
-import net.shibboleth.idp.authn.context.AuthenticationContext;
-import net.shibboleth.idp.authn.context.AuthenticationErrorContext;
-import net.shibboleth.idp.authn.context.AuthenticationWarningContext;
-import net.shibboleth.idp.authn.context.LDAPResponseContext;
-import net.shibboleth.idp.authn.context.UsernamePasswordContext;
-import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
-import net.shibboleth.idp.authn.principal.UsernamePrincipal;
-import net.shibboleth.idp.profile.testing.ActionTestingSupport;
-import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-import net.shibboleth.utilities.java.support.velocity.VelocityEngine;
-
import org.ldaptive.DefaultConnectionFactory;
import org.ldaptive.LdapException;
import org.ldaptive.auth.AccountState;
@@ -66,6 +53,21 @@ import com.unboundid.ldap.listener.InMemoryDirectoryServerConfig;
import com.unboundid.ldap.listener.InMemoryListenerConfig;
import com.unboundid.ldap.sdk.LDAPException;
+import jakarta.servlet.http.HttpServletRequest;
+import net.shibboleth.idp.authn.AuthenticationResult;
+import net.shibboleth.idp.authn.AuthnEventIds;
+import net.shibboleth.idp.authn.TemplateSearchDnResolver;
+import net.shibboleth.idp.authn.context.AuthenticationContext;
+import net.shibboleth.idp.authn.context.AuthenticationErrorContext;
+import net.shibboleth.idp.authn.context.AuthenticationWarningContext;
+import net.shibboleth.idp.authn.context.LDAPResponseContext;
+import net.shibboleth.idp.authn.context.UsernamePasswordContext;
+import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
+import net.shibboleth.idp.authn.principal.UsernamePrincipal;
+import net.shibboleth.idp.profile.testing.ActionTestingSupport;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+import net.shibboleth.utilities.java.support.velocity.VelocityEngine;
+
/** Unit test for LDAP credential validation. */
public class LDAPCredentialValidatorTest extends BaseAuthenticationContextTest {
@@ -134,7 +136,8 @@ public class LDAPCredentialValidatorTest extends BaseAuthenticationContextTest {
mappings.put("ExpiringPassword", Collections.singleton("ACCOUNT_WARNING"));
mappings.put("ExpiredPassword", Arrays.asList("PASSWORD_EXPIRED", "CHANGE_AFTER_RESET"));
action.setClassifiedMessages(mappings);
- action.setHttpServletRequest(new MockHttpServletRequest());
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
}
@Test public void testMissingFlow() throws ComponentInitializationException {
@@ -679,7 +682,7 @@ public class LDAPCredentialValidatorTest extends BaseAuthenticationContextTest {
private void doExtract() throws ComponentInitializationException {
final ExtractUsernamePasswordFromFormRequest extract = new ExtractUsernamePasswordFromFormRequest();
- extract.setHttpServletRequest(action.getHttpServletRequest());
+ extract.setHttpServletRequestSupplier(action.getHttpServletRequestSupplier());
extract.initialize();
extract.execute(src);
}
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/PreserveAuthenticationFlowStateTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/PreserveAuthenticationFlowStateTest.java
index 66cc0d7a1..faed04ad0 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/PreserveAuthenticationFlowStateTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/PreserveAuthenticationFlowStateTest.java
@@ -18,12 +18,8 @@
package net.shibboleth.idp.authn.impl;
-import net.shibboleth.idp.authn.context.AuthenticationContext;
-import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
-import net.shibboleth.idp.profile.testing.ActionTestingSupport;
-import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-
import java.util.Arrays;
+import java.util.function.Supplier;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.webflow.execution.Event;
@@ -31,6 +27,12 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import jakarta.servlet.http.HttpServletRequest;
+import net.shibboleth.idp.authn.context.AuthenticationContext;
+import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
+import net.shibboleth.idp.profile.testing.ActionTestingSupport;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+
/** {@link PreserveAuthenticationFlowState} unit test. */
public class PreserveAuthenticationFlowStateTest extends BaseAuthenticationContextTest {
@@ -40,7 +42,8 @@ public class PreserveAuthenticationFlowStateTest extends BaseAuthenticationConte
super.setUp();
action = new PreserveAuthenticationFlowState();
- action.setHttpServletRequest(new MockHttpServletRequest());
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
action.setParameterNames(Arrays.asList("foo", "foo2"));
action.initialize();
}
@@ -57,7 +60,8 @@ public class PreserveAuthenticationFlowStateTest extends BaseAuthenticationConte
@Test public void testNoParameters() throws ComponentInitializationException {
action = new PreserveAuthenticationFlowState();
- action.setHttpServletRequest(new MockHttpServletRequest());
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
action.initialize();
final Event event = action.execute(src);
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateCredentialsTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateCredentialsTest.java
index 6a810ad7a..771c24d9b 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateCredentialsTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateCredentialsTest.java
@@ -23,19 +23,7 @@ import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
-
-import net.shibboleth.idp.authn.AuthenticationResult;
-import net.shibboleth.idp.authn.AuthnEventIds;
-import net.shibboleth.idp.authn.TemplateSearchDnResolver;
-import net.shibboleth.idp.authn.context.AuthenticationContext;
-import net.shibboleth.idp.authn.context.AuthenticationErrorContext;
-import net.shibboleth.idp.authn.context.LDAPResponseContext;
-import net.shibboleth.idp.authn.context.UsernamePasswordContext;
-import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
-import net.shibboleth.idp.authn.principal.UsernamePrincipal;
-import net.shibboleth.idp.profile.testing.ActionTestingSupport;
-import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-import net.shibboleth.utilities.java.support.velocity.VelocityEngine;
+import java.util.function.Supplier;
import org.ldaptive.DefaultConnectionFactory;
import org.ldaptive.auth.AuthenticationResultCode;
@@ -56,6 +44,20 @@ import com.unboundid.ldap.listener.InMemoryDirectoryServerConfig;
import com.unboundid.ldap.listener.InMemoryListenerConfig;
import com.unboundid.ldap.sdk.LDAPException;
+import jakarta.servlet.http.HttpServletRequest;
+import net.shibboleth.idp.authn.AuthenticationResult;
+import net.shibboleth.idp.authn.AuthnEventIds;
+import net.shibboleth.idp.authn.TemplateSearchDnResolver;
+import net.shibboleth.idp.authn.context.AuthenticationContext;
+import net.shibboleth.idp.authn.context.AuthenticationErrorContext;
+import net.shibboleth.idp.authn.context.LDAPResponseContext;
+import net.shibboleth.idp.authn.context.UsernamePasswordContext;
+import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
+import net.shibboleth.idp.authn.principal.UsernamePrincipal;
+import net.shibboleth.idp.profile.testing.ActionTestingSupport;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+import net.shibboleth.utilities.java.support.velocity.VelocityEngine;
+
/** Unit test for multiple credential validation. */
public class ValidateCredentialsTest extends BaseAuthenticationContextTest {
@@ -130,7 +132,8 @@ public class ValidateCredentialsTest extends BaseAuthenticationContextTest {
mappings.put("ExpiringPassword", Collections.singleton("ACCOUNT_WARNING"));
mappings.put("ExpiredPassword", Arrays.asList("PASSWORD_EXPIRED", "CHANGE_AFTER_RESET"));
action.setClassifiedMessages(mappings);
- action.setHttpServletRequest(new MockHttpServletRequest());
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
}
@Test public void testBadUsername() throws ComponentInitializationException {
@@ -340,7 +343,7 @@ public class ValidateCredentialsTest extends BaseAuthenticationContextTest {
private void doExtract() throws ComponentInitializationException {
final ExtractUsernamePasswordFromFormRequest extract = new ExtractUsernamePasswordFromFormRequest();
- extract.setHttpServletRequest(action.getHttpServletRequest());
+ extract.setHttpServletRequestSupplier(action.getHttpServletRequestSupplier());
extract.initialize();
extract.execute(src);
}
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateExternalAuthenticationTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateExternalAuthenticationTest.java
index 958678829..2a09ca1f5 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateExternalAuthenticationTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateExternalAuthenticationTest.java
@@ -20,10 +20,12 @@ package net.shibboleth.idp.authn.impl;
import java.time.Instant;
import java.util.Arrays;
import java.util.Set;
+import java.util.function.Supplier;
import javax.security.auth.Subject;
import javax.security.auth.login.LoginException;
+import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.webflow.execution.Event;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
@@ -57,7 +59,8 @@ public class ValidateExternalAuthenticationTest extends BaseAuthenticationContex
ext = new ExternalAuthenticationImpl();
action = new ValidateExternalAuthentication();
- action.setHttpServletRequest((HttpServletRequest) src.getExternalContext().getNativeRequest());
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
action.initialize();
}
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateRemoteUserTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateRemoteUserTest.java
index 5d93a4330..f69c15b4b 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateRemoteUserTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateRemoteUserTest.java
@@ -19,6 +19,7 @@ package net.shibboleth.idp.authn.impl;
import java.util.Arrays;
+import java.util.function.Supplier;
import java.util.regex.Pattern;
import org.springframework.mock.web.MockHttpServletRequest;
@@ -47,7 +48,8 @@ public class ValidateRemoteUserTest extends BaseAuthenticationContextTest {
action.setAllowedUsernames(Arrays.asList("bar", "baz"));
action.setDeniedUsernames(Arrays.asList("foo"));
action.setMatchExpression(Pattern.compile("^ba(r|z|n)$"));
- action.setHttpServletRequest((HttpServletRequest) src.getExternalContext().getNativeRequest());
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
action.initialize();
}
@@ -128,7 +130,7 @@ public class ValidateRemoteUserTest extends BaseAuthenticationContextTest {
private void doExtract() throws ComponentInitializationException {
final ExtractRemoteUser extract = new ExtractRemoteUser();
- extract.setHttpServletRequest(action.getHttpServletRequest());
+ extract.setHttpServletRequestSupplier(action.getHttpServletRequestSupplier());
extract.initialize();
extract.execute(src);
}
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateUserAgentAddressTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateUserAgentAddressTest.java
index de8716312..f69b2dc96 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateUserAgentAddressTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/ValidateUserAgentAddressTest.java
@@ -22,7 +22,15 @@ import java.security.Principal;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
+import java.util.function.Supplier;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.webflow.execution.Event;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import jakarta.servlet.http.HttpServletRequest;
import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.idp.authn.context.RequestedPrincipalContext;
@@ -34,12 +42,6 @@ import net.shibboleth.idp.profile.testing.ActionTestingSupport;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
import net.shibboleth.utilities.java.support.net.IPRange;
-import org.springframework.mock.web.MockHttpServletRequest;
-import org.springframework.webflow.execution.Event;
-import org.testng.Assert;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
/** {@link ValidateUserAgentAddress} unit test. */
public class ValidateUserAgentAddressTest extends BaseAuthenticationContextTest {
@@ -52,7 +54,8 @@ public class ValidateUserAgentAddressTest extends BaseAuthenticationContextTest
action.setMappings(Collections.<String,Collection<IPRange>>singletonMap(
"foo", Arrays.asList(IPRange.parseCIDRBlock("192.168.1.0/24"))));
action.setSupportedPrincipals(Arrays.asList(new TestPrincipal("UserAgentAuthentication")));
- action.setHttpServletRequest(new MockHttpServletRequest());
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
action.initialize();
}
@@ -132,7 +135,7 @@ public class ValidateUserAgentAddressTest extends BaseAuthenticationContextTest
private void doExtract() throws ComponentInitializationException {
final ExtractUserAgentAddress extract = new ExtractUserAgentAddress();
- extract.setHttpServletRequest(action.getHttpServletRequest());
+ extract.setHttpServletRequestSupplier(action.getHttpServletRequestSupplier());
extract.initialize();
extract.execute(src);
}
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/X509CertificateCredentialValidatorTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/X509CertificateCredentialValidatorTest.java
index 401800907..99848069c 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/X509CertificateCredentialValidatorTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/X509CertificateCredentialValidatorTest.java
@@ -21,15 +21,10 @@ package net.shibboleth.idp.authn.impl;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.Collections;
+import java.util.function.Supplier;
import javax.security.auth.x500.X500Principal;
-import net.shibboleth.idp.authn.AuthnEventIds;
-import net.shibboleth.idp.authn.context.AuthenticationContext;
-import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
-import net.shibboleth.idp.profile.testing.ActionTestingSupport;
-import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-
import org.opensaml.security.credential.CredentialResolver;
import org.opensaml.security.credential.impl.StaticCredentialResolver;
import org.opensaml.security.trust.TrustEngine;
@@ -43,6 +38,13 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import jakarta.servlet.http.HttpServletRequest;
+import net.shibboleth.idp.authn.AuthnEventIds;
+import net.shibboleth.idp.authn.context.AuthenticationContext;
+import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
+import net.shibboleth.idp.profile.testing.ActionTestingSupport;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+
/** {@link X509CertificateCredentialValidator} unit test. */
public class X509CertificateCredentialValidatorTest extends BaseAuthenticationContextTest {
@@ -102,7 +104,8 @@ public class X509CertificateCredentialValidatorTest extends BaseAuthenticationCo
action = new ValidateCredentials();
action.setValidators(Collections.singletonList(validator));
- action.setHttpServletRequest(new MockHttpServletRequest());
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
action.initialize();
}
@@ -191,7 +194,7 @@ public class X509CertificateCredentialValidatorTest extends BaseAuthenticationCo
private void doExtract() throws ComponentInitializationException, CertificateException {
final ExtractX509CertificateFromRequest extract = new ExtractX509CertificateFromRequest();
- extract.setHttpServletRequest(action.getHttpServletRequest());
+ extract.setHttpServletRequestSupplier(action.getHttpServletRequestSupplier());
extract.initialize();
extract.execute(src);
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/proxy/impl/ExtractDiscoveryResponseTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/proxy/impl/ExtractDiscoveryResponseTest.java
index 8d8f04164..75cfa4759 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/proxy/impl/ExtractDiscoveryResponseTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/proxy/impl/ExtractDiscoveryResponseTest.java
@@ -18,11 +18,7 @@
package net.shibboleth.idp.authn.proxy.impl;
-import net.shibboleth.idp.authn.AuthnEventIds;
-import net.shibboleth.idp.authn.context.AuthenticationContext;
-import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
-import net.shibboleth.idp.profile.testing.ActionTestingSupport;
-import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+import java.util.function.Supplier;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.webflow.execution.Event;
@@ -30,6 +26,13 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import jakarta.servlet.http.HttpServletRequest;
+import net.shibboleth.idp.authn.AuthnEventIds;
+import net.shibboleth.idp.authn.context.AuthenticationContext;
+import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
+import net.shibboleth.idp.profile.testing.ActionTestingSupport;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+
/** {@link ExtractDiscoveryResponse} unit test. */
public class ExtractDiscoveryResponseTest extends BaseAuthenticationContextTest {
@@ -39,7 +42,8 @@ public class ExtractDiscoveryResponseTest extends BaseAuthenticationContextTest
super.setUp();
action = new ExtractDiscoveryResponse();
- action.setHttpServletRequest(new MockHttpServletRequest());
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
action.initialize();
}
diff --git a/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/flow/impl/ExtractConsentTest.java b/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/flow/impl/ExtractConsentTest.java
index 66a7bdbbb..5759989ca 100644
--- a/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/flow/impl/ExtractConsentTest.java
+++ b/idp-consent-impl/src/test/java/net/shibboleth/idp/consent/flow/impl/ExtractConsentTest.java
@@ -17,10 +17,7 @@
package net.shibboleth.idp.consent.flow.impl;
-import net.shibboleth.idp.consent.Consent;
-import net.shibboleth.idp.consent.context.ConsentContext;
-import net.shibboleth.idp.consent.impl.ConsentTestingSupport;
-import net.shibboleth.idp.profile.testing.ActionTestingSupport;
+import java.util.function.Supplier;
import org.opensaml.profile.action.EventIds;
import org.springframework.mock.web.MockHttpServletRequest;
@@ -29,6 +26,12 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import jakarta.servlet.http.HttpServletRequest;
+import net.shibboleth.idp.consent.Consent;
+import net.shibboleth.idp.consent.context.ConsentContext;
+import net.shibboleth.idp.consent.impl.ConsentTestingSupport;
+import net.shibboleth.idp.profile.testing.ActionTestingSupport;
+
/** {@link ExtractConsent} unit test. */
public class ExtractConsentTest extends AbstractConsentActionTest {
@@ -57,7 +60,8 @@ public class ExtractConsentTest extends AbstractConsentActionTest {
@Test public void testNoUserInput() throws Exception {
action = new ExtractConsent();
- action.setHttpServletRequest(new MockHttpServletRequest());
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
action.initialize();
final Event event = action.execute(src);
@@ -79,7 +83,7 @@ public class ExtractConsentTest extends AbstractConsentActionTest {
httpServletRequest.setParameter(ExtractConsent.CONSENT_IDS_REQUEST_PARAMETER, "consent1");
action = new ExtractConsent();
- action.setHttpServletRequest(httpServletRequest);
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return httpServletRequest;}});
action.initialize();
final Event event = action.execute(src);
@@ -102,7 +106,7 @@ public class ExtractConsentTest extends AbstractConsentActionTest {
httpServletRequest.addParameter(ExtractConsent.CONSENT_IDS_REQUEST_PARAMETER, "consent2");
action = new ExtractConsent();
- action.setHttpServletRequest(httpServletRequest);
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return httpServletRequest;}});
action.initialize();
final Event event = action.execute(src);
diff --git a/idp-profile-impl/src/test/java/net/shibboleth/idp/profile/audit/impl/WriteAuditLogTest.java b/idp-profile-impl/src/test/java/net/shibboleth/idp/profile/audit/impl/WriteAuditLogTest.java
index a09e004bf..92331d0bc 100644
--- a/idp-profile-impl/src/test/java/net/shibboleth/idp/profile/audit/impl/WriteAuditLogTest.java
+++ b/idp-profile-impl/src/test/java/net/shibboleth/idp/profile/audit/impl/WriteAuditLogTest.java
@@ -19,17 +19,11 @@ package net.shibboleth.idp.profile.audit.impl;
import java.util.Collections;
import java.util.List;
+import java.util.function.Supplier;
import javax.annotation.Nonnull;
import org.opensaml.profile.context.ProfileRequestContext;
-
-import net.shibboleth.idp.profile.context.AuditContext;
-import net.shibboleth.idp.profile.context.navigate.WebflowRequestContextProfileRequestContextLookup;
-import net.shibboleth.idp.profile.testing.ActionTestingSupport;
-import net.shibboleth.idp.profile.testing.RequestContextBuilder;
-import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.webflow.execution.Event;
import org.springframework.webflow.execution.RequestContext;
@@ -37,6 +31,13 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import jakarta.servlet.http.HttpServletRequest;
+import net.shibboleth.idp.profile.context.AuditContext;
+import net.shibboleth.idp.profile.context.navigate.WebflowRequestContextProfileRequestContextLookup;
+import net.shibboleth.idp.profile.testing.ActionTestingSupport;
+import net.shibboleth.idp.profile.testing.RequestContextBuilder;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+
/** {@link WriteAuditLog} unit test. */
public class WriteAuditLogTest {
@@ -60,7 +61,7 @@ public class WriteAuditLogTest {
mock.setRequestURI("/path/to/foo");
action = new FilteringAction();
- action.setHttpServletRequest(mock);
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return mock;}});
}
@Test public void testNoRules() throws Exception {
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/AddAuthenticationStatementToAssertionTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/AddAuthenticationStatementToAssertionTest.java
index 30fbcc7a6..849dc7123 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/AddAuthenticationStatementToAssertionTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/AddAuthenticationStatementToAssertionTest.java
@@ -18,28 +18,13 @@
package net.shibboleth.idp.saml.saml1.profile.impl;
import java.time.Instant;
+import java.util.function.Supplier;
import javax.security.auth.Subject;
-import net.shibboleth.idp.authn.AuthenticationFlowDescriptor;
-import net.shibboleth.idp.authn.AuthenticationResult;
-import net.shibboleth.idp.authn.AuthnEventIds;
-import net.shibboleth.idp.authn.context.AuthenticationContext;
-import net.shibboleth.idp.authn.context.RequestedPrincipalContext;
-import net.shibboleth.idp.authn.impl.DefaultAuthenticationResultSerializer;
-
import org.opensaml.core.testing.OpenSAMLInitBaseTestCase;
import org.opensaml.profile.action.EventIds;
import org.opensaml.profile.context.ProfileRequestContext;
-
-import net.shibboleth.idp.profile.context.RelyingPartyContext;
-import net.shibboleth.idp.profile.context.navigate.WebflowRequestContextProfileRequestContextLookup;
-import net.shibboleth.idp.profile.testing.ActionTestingSupport;
-import net.shibboleth.idp.profile.testing.RequestContextBuilder;
-import net.shibboleth.idp.saml.authn.principal.AuthenticationMethodPrincipal;
-import net.shibboleth.idp.saml.saml1.profile.SAML1ActionTestingSupport;
-import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-
import org.opensaml.saml.saml1.core.Assertion;
import org.opensaml.saml.saml1.core.AuthenticationStatement;
import org.opensaml.saml.saml1.core.Response;
@@ -51,6 +36,21 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import jakarta.servlet.http.HttpServletRequest;
+import net.shibboleth.idp.authn.AuthenticationFlowDescriptor;
+import net.shibboleth.idp.authn.AuthenticationResult;
+import net.shibboleth.idp.authn.AuthnEventIds;
+import net.shibboleth.idp.authn.context.AuthenticationContext;
+import net.shibboleth.idp.authn.context.RequestedPrincipalContext;
+import net.shibboleth.idp.authn.impl.DefaultAuthenticationResultSerializer;
+import net.shibboleth.idp.profile.context.RelyingPartyContext;
+import net.shibboleth.idp.profile.context.navigate.WebflowRequestContextProfileRequestContextLookup;
+import net.shibboleth.idp.profile.testing.ActionTestingSupport;
+import net.shibboleth.idp.profile.testing.RequestContextBuilder;
+import net.shibboleth.idp.saml.authn.principal.AuthenticationMethodPrincipal;
+import net.shibboleth.idp.saml.saml1.profile.SAML1ActionTestingSupport;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+
/** {@link AddAuthenticationStatementToAssertion} unit test. */
public class AddAuthenticationStatementToAssertionTest extends OpenSAMLInitBaseTestCase {
@@ -66,7 +66,8 @@ public class AddAuthenticationStatementToAssertionTest extends OpenSAMLInitBaseT
prc = new WebflowRequestContextProfileRequestContextLookup().apply(rc);
action = new AddAuthenticationStatementToAssertion();
- action.setHttpServletRequest(new MockHttpServletRequest());
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
action.initialize();
}
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/AddAuthnStatementToAssertionTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/AddAuthnStatementToAssertionTest.java
index af300e935..ac79f1753 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/AddAuthnStatementToAssertionTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/AddAuthnStatementToAssertionTest.java
@@ -20,9 +20,26 @@ package net.shibboleth.idp.saml.saml2.profile.impl;
import java.time.Duration;
import java.time.Instant;
import java.util.List;
+import java.util.function.Supplier;
import javax.security.auth.Subject;
+import org.opensaml.core.testing.OpenSAMLInitBaseTestCase;
+import org.opensaml.profile.action.EventIds;
+import org.opensaml.profile.context.ProfileRequestContext;
+import org.opensaml.saml.saml2.core.Assertion;
+import org.opensaml.saml.saml2.core.AuthnContext;
+import org.opensaml.saml.saml2.core.AuthnStatement;
+import org.opensaml.saml.saml2.core.Response;
+import org.opensaml.storage.StorageSerializer;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.webflow.execution.Event;
+import org.springframework.webflow.execution.RequestContext;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import jakarta.servlet.http.HttpServletRequest;
import net.shibboleth.idp.authn.AuthenticationFlowDescriptor;
import net.shibboleth.idp.authn.AuthenticationResult;
import net.shibboleth.idp.authn.AuthnEventIds;
@@ -30,11 +47,6 @@ import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.idp.authn.context.RequestedPrincipalContext;
import net.shibboleth.idp.authn.impl.DefaultAuthenticationResultSerializer;
import net.shibboleth.idp.authn.principal.ProxyAuthenticationPrincipal;
-
-import org.opensaml.core.testing.OpenSAMLInitBaseTestCase;
-import org.opensaml.profile.action.EventIds;
-import org.opensaml.profile.context.ProfileRequestContext;
-
import net.shibboleth.idp.profile.config.SecurityConfiguration;
import net.shibboleth.idp.profile.context.RelyingPartyContext;
import net.shibboleth.idp.profile.context.navigate.WebflowRequestContextProfileRequestContextLookup;
@@ -45,18 +57,6 @@ import net.shibboleth.idp.saml.saml2.profile.SAML2ActionTestingSupport;
import net.shibboleth.idp.saml.saml2.profile.config.BrowserSSOProfileConfiguration;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-import org.opensaml.saml.saml2.core.Assertion;
-import org.opensaml.saml.saml2.core.AuthnContext;
-import org.opensaml.saml.saml2.core.AuthnStatement;
-import org.opensaml.saml.saml2.core.Response;
-import org.opensaml.storage.StorageSerializer;
-import org.springframework.mock.web.MockHttpServletRequest;
-import org.springframework.webflow.execution.Event;
-import org.springframework.webflow.execution.RequestContext;
-import org.testng.Assert;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
/** {@link AddAuthnStatementToAssertion} unit test. */
@SuppressWarnings("javadoc")
public class AddAuthnStatementToAssertionTest extends OpenSAMLInitBaseTestCase {
@@ -73,7 +73,8 @@ public class AddAuthnStatementToAssertionTest extends OpenSAMLInitBaseTestCase {
prc = new WebflowRequestContextProfileRequestContextLookup().apply(rc);
action = new AddAuthnStatementToAssertion();
- action.setHttpServletRequest(new MockHttpServletRequest());
+ final MockHttpServletRequest request = new MockHttpServletRequest();
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
action.initialize();
}
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessAssertionsForAuthenticationTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessAssertionsForAuthenticationTest.java
index 7a558ebc1..61bb0a403 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessAssertionsForAuthenticationTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/ProcessAssertionsForAuthenticationTest.java
@@ -22,6 +22,7 @@ import java.time.Instant;
import java.util.Collections;
import java.util.List;
import java.util.function.Function;
+import java.util.function.Supplier;
import org.opensaml.core.testing.OpenSAMLInitBaseTestCase;
import org.opensaml.core.xml.util.XMLObjectSupport;
@@ -47,6 +48,8 @@ import org.testng.annotations.Test;
import com.google.common.base.Predicates;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
@@ -70,8 +73,8 @@ public class ProcessAssertionsForAuthenticationTest extends OpenSAMLInitBaseTest
httpResponse = new MockHttpServletResponse();
action = new ProcessAssertionsForAuthentication();
- action.setHttpServletRequest(httpRequest);
- action.setHttpServletResponse(httpResponse);
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return httpRequest;}});
+ action.setHttpServletResponseSupplier(new Supplier<> () {public HttpServletResponse get() { return httpResponse;}});
samlResponse = SAML2ActionTestingSupport.buildResponse();
diff --git a/idp-session-impl/src/test/java/net/shibboleth/idp/session/impl/PopulateSessionContextTest.java b/idp-session-impl/src/test/java/net/shibboleth/idp/session/impl/PopulateSessionContextTest.java
index 10ce0b647..289228779 100644
--- a/idp-session-impl/src/test/java/net/shibboleth/idp/session/impl/PopulateSessionContextTest.java
+++ b/idp-session-impl/src/test/java/net/shibboleth/idp/session/impl/PopulateSessionContextTest.java
@@ -17,16 +17,7 @@
package net.shibboleth.idp.session.impl;
-import jakarta.servlet.http.Cookie;
-
-import net.shibboleth.idp.profile.context.navigate.WebflowRequestContextProfileRequestContextLookup;
-import net.shibboleth.idp.profile.testing.ActionTestingSupport;
-import net.shibboleth.idp.profile.testing.RequestContextBuilder;
-import net.shibboleth.idp.session.SessionException;
-import net.shibboleth.idp.session.context.SessionContext;
-import net.shibboleth.idp.session.impl.testing.SessionManagerBaseTestCase;
-import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
-import net.shibboleth.utilities.java.support.net.HttpServletRequestResponseContext;
+import java.util.function.Supplier;
import org.opensaml.profile.context.ProfileRequestContext;
import org.springframework.mock.web.MockHttpServletRequest;
@@ -37,6 +28,18 @@ import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
+import jakarta.servlet.http.Cookie;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
+import net.shibboleth.idp.profile.context.navigate.WebflowRequestContextProfileRequestContextLookup;
+import net.shibboleth.idp.profile.testing.ActionTestingSupport;
+import net.shibboleth.idp.profile.testing.RequestContextBuilder;
+import net.shibboleth.idp.session.SessionException;
+import net.shibboleth.idp.session.context.SessionContext;
+import net.shibboleth.idp.session.impl.testing.SessionManagerBaseTestCase;
+import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+import net.shibboleth.utilities.java.support.net.HttpServletRequestResponseContext;
+
/** {@link PopulateSessionContext} unit test. */
@SuppressWarnings("javadoc")
public class PopulateSessionContextTest extends SessionManagerBaseTestCase {
@@ -52,8 +55,8 @@ public class PopulateSessionContextTest extends SessionManagerBaseTestCase {
prc = new WebflowRequestContextProfileRequestContextLookup().apply(src);
action = new PopulateSessionContext();
- action.setHttpServletRequest(requestProxy);
- action.setHttpServletResponse(responseProxy);
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return requestProxy;}});
+ action.setHttpServletResponseSupplier(new Supplier<> () {public HttpServletResponse get() { return responseProxy;}});
action.setSessionResolver(sessionManager);
action.initialize();
}
@@ -121,8 +124,8 @@ public class PopulateSessionContextTest extends SessionManagerBaseTestCase {
@Test public void testAddressLookup() throws ComponentInitializationException, SessionException {
action = new PopulateSessionContext();
- action.setHttpServletRequest(requestProxy);
- action.setHttpServletResponse(responseProxy);
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return requestProxy;}});
+ action.setHttpServletResponseSupplier(new Supplier<> () {public HttpServletResponse get() { return responseProxy;}});
action.setSessionResolver(sessionManager);
action.setAddressLookupStrategy(input -> requestProxy.getHeader("User-Agent"));
action.initialize();
@@ -142,4 +145,4 @@ public class PopulateSessionContextTest extends SessionManagerBaseTestCase {
Assert.assertTrue(sessionCtx.getIdPSession().checkAddress("UnitTest-Client"));
}
-}
\ No newline at end of file
+}
diff --git a/idp-session-impl/src/test/java/net/shibboleth/idp/session/impl/ProcessLogoutTest.java b/idp-session-impl/src/test/java/net/shibboleth/idp/session/impl/ProcessLogoutTest.java
index cb7e39559..bf62f9f87 100644
--- a/idp-session-impl/src/test/java/net/shibboleth/idp/session/impl/ProcessLogoutTest.java
+++ b/idp-session-impl/src/test/java/net/shibboleth/idp/session/impl/ProcessLogoutTest.java
@@ -20,9 +20,21 @@ package net.shibboleth.idp.session.impl;
import java.time.Duration;
import java.time.Instant;
import java.util.Collections;
+import java.util.function.Supplier;
-import jakarta.servlet.http.Cookie;
+import org.opensaml.profile.context.ProfileRequestContext;
+import org.opensaml.storage.StorageSerializer;
+import org.springframework.mock.web.MockHttpServletRequest;
+import org.springframework.mock.web.MockHttpServletResponse;
+import org.springframework.webflow.execution.Event;
+import org.springframework.webflow.execution.RequestContext;
+import org.testng.Assert;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+import jakarta.servlet.http.Cookie;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import net.shibboleth.idp.authn.context.SubjectContext;
import net.shibboleth.idp.profile.context.navigate.WebflowRequestContextProfileRequestContextLookup;
import net.shibboleth.idp.profile.testing.ActionTestingSupport;
@@ -40,16 +52,6 @@ import net.shibboleth.utilities.java.support.net.HttpServletRequestResponseConte
import net.shibboleth.utilities.java.support.resolver.CriteriaSet;
import net.shibboleth.utilities.java.support.resolver.ResolverException;
-import org.opensaml.profile.context.ProfileRequestContext;
-import org.opensaml.storage.StorageSerializer;
-import org.springframework.mock.web.MockHttpServletRequest;
-import org.springframework.mock.web.MockHttpServletResponse;
-import org.springframework.webflow.execution.Event;
-import org.springframework.webflow.execution.RequestContext;
-import org.testng.Assert;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
/** {@link ProcessLogout} unit test. */
@SuppressWarnings("javadoc")
public class ProcessLogoutTest extends SessionManagerBaseTestCase {
@@ -65,8 +67,8 @@ public class ProcessLogoutTest extends SessionManagerBaseTestCase {
prc = new WebflowRequestContextProfileRequestContextLookup().apply(src);
action = new ProcessLogout();
- action.setHttpServletRequest(requestProxy);
- action.setHttpServletResponse(responseProxy);
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return requestProxy;}});
+ action.setHttpServletResponseSupplier(new Supplier<> () {public HttpServletResponse get() { return responseProxy;}});
action.setSessionResolver(sessionManager);
action.initialize();
}
@@ -188,8 +190,8 @@ public class ProcessLogoutTest extends SessionManagerBaseTestCase {
@Test public void testAddressLookup() throws ComponentInitializationException, SessionException, ResolverException {
action = new ProcessLogout();
- action.setHttpServletRequest(requestProxy);
- action.setHttpServletResponse(responseProxy);
+ action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return requestProxy;}});
+ action.setHttpServletResponseSupplier(new Supplier<> () {public HttpServletResponse get() { return responseProxy;}});
action.setSessionResolver(sessionManager);
action.setAddressLookupStrategy(input -> requestProxy.getHeader("User-Agent"));
action.initialize();
@@ -213,4 +215,4 @@ public class ProcessLogoutTest extends SessionManagerBaseTestCase {
sessionManager.destroySession(session.getId(), false);
}
-}
\ No newline at end of file
+}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list