[java-identity-provider] branch main updated: IDP-1793 Use Suppliers for HttpRequest/Response
Rod Widdowson
rdw at steadingsoftware.com
Sun Nov 20 14:49:19 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=d755caa14eb2bb2e5903744805125473fbe2eda2
The following commit(s) were added to refs/heads/main by this push:
new d755caa14 IDP-1793 Use Suppliers for HttpRequest/Response
d755caa14 is described below
commit d755caa14eb2bb2e5903744805125473fbe2eda2
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sun Nov 20 14:41:16 2022 +0000
IDP-1793 Use Suppliers for HttpRequest/Response
https://shibboleth.atlassian.net/browse/IDP-1793
Use the new NonNullSupplier interface for our
HttpServletXyz objects.
---
.../idp/admin/impl/DoStorageOperationTest.java | 10 +++++-----
...ializeAdministrativeProfileContextTreeTest.java | 4 ++--
.../impl/StorageBackedAccountLockoutManager.java | 6 +++---
.../revocation/impl/RevocationCacheCondition.java | 8 ++++----
.../ExtractDuoAuthenticationFromHeadersTest.java | 22 ++++++++++------------
.../idp/authn/impl/ExtractRemoteUserTest.java | 17 ++++++++---------
.../authn/impl/ExtractUserAgentAddressTest.java | 5 ++---
.../authn/impl/ExtractUserAgentIdentifierTest.java | 5 ++---
.../ExtractUsernamePasswordFromBasicAuthTest.java | 5 ++---
...ExtractUsernamePasswordFromFormRequestTest.java | 5 ++---
.../ExtractX509CertificateFromRequestTest.java | 4 ++--
.../impl/HTPasswdCredentialValidatorTest.java | 4 ++--
.../authn/impl/JAASCredentialValidatorTest.java | 8 ++++----
.../authn/impl/LDAPCredentialValidatorTest.java | 10 +++++-----
.../impl/PreserveAuthenticationFlowStateTest.java | 6 +++---
.../StorageBackedAccountLockoutManagerTest.java | 4 ++--
.../idp/authn/impl/ValidateCredentialsTest.java | 8 ++++----
.../impl/ValidateExternalAuthenticationTest.java | 4 ++--
.../idp/authn/impl/ValidateRemoteUserTest.java | 4 ++--
.../authn/impl/ValidateUserAgentAddressTest.java | 4 ++--
.../X509CertificateCredentialValidatorTest.java | 4 ++--
.../proxy/impl/ExtractDiscoveryResponseTest.java | 5 ++---
.../spnego/impl/SPNEGOAutoLoginManagerTest.java | 17 ++++++++---------
.../idp/consent/flow/impl/ExtractConsentTest.java | 9 ++++-----
.../idp/installer/InstallerPropertiesImpl.java | 2 +-
.../idp/profile/audit/impl/WriteAuditLogTest.java | 4 ++--
.../AddAuthenticationStatementToAssertionTest.java | 4 ++--
.../IdPInitiatedSSORequestMessageDecoderTest.java | 4 ++--
.../impl/AddAuthnStatementToAssertionTest.java | 4 ++--
.../IdPInitiatedSSORequestMessageDecoderTest.java | 4 ++--
.../ProcessAssertionsForAuthenticationTest.java | 6 +++---
.../session/impl/StorageBackedSessionManager.java | 6 +++---
.../idp/ui/context/RelyingPartyUIContext.java | 8 ++++----
33 files changed, 105 insertions(+), 115 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 0eb897d17..4f875a950 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
@@ -22,11 +22,8 @@ import java.text.ParseException;
import java.time.Duration;
import java.time.Instant;
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.opensaml.storage.StorageRecord;
import org.opensaml.storage.impl.MemoryStorageService;
@@ -42,10 +39,13 @@ import org.testng.annotations.Test;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.databind.ObjectMapper;
+import jakarta.servlet.http.HttpServletRequest;
+import jakarta.servlet.http.HttpServletResponse;
import net.shibboleth.idp.profile.testing.ActionTestingSupport;
import net.shibboleth.idp.profile.testing.RequestContextBuilder;
import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.NonNullSupplier;
/**
* Unit test for {@link DoStorageOperation} action.
@@ -91,8 +91,8 @@ public class DoStorageOperationTest {
mapper.setSerializationInclusion(Include.NON_NULL);
action = new DoStorageOperation();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
- action.setHttpServletResponseSupplier(new Supplier<> () {public HttpServletResponse get() {return response;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletResponseSupplier(new NonNullSupplier<> () {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 b2fb91b6d..1da5479da 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,7 +18,6 @@
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;
@@ -38,6 +37,7 @@ import net.shibboleth.idp.profile.testing.RequestContextBuilder;
import net.shibboleth.idp.ui.context.RelyingPartyUIContext;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.primitive.LangBearingString;
+import net.shibboleth.shared.primitive.NonNullSupplier;
/** {@link InitializeAdministrativeProfileContextTree} unit test. */
@SuppressWarnings("javadoc")
@@ -66,7 +66,7 @@ public class InitializeAdministrativeProfileContextTreeTest extends OpenSAMLInit
action = new InitializeAdministrativeProfileContextTree();
action.setAdministrativeFlowDescriptor(descriptor);
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() {
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {public HttpServletRequest get() {
return (HttpServletRequest) src.getExternalContext().getNativeRequest();
}
});
diff --git a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/StorageBackedAccountLockoutManager.java b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/StorageBackedAccountLockoutManager.java
index 67b8c1bea..e85b6761e 100644
--- a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/StorageBackedAccountLockoutManager.java
+++ b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/StorageBackedAccountLockoutManager.java
@@ -21,7 +21,6 @@ import java.io.IOException;
import java.time.Duration;
import java.time.Instant;
import java.util.function.Function;
-import java.util.function.Supplier;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -45,6 +44,7 @@ import net.shibboleth.shared.component.AbstractIdentifiableInitializableComponen
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.logic.FunctionSupport;
+import net.shibboleth.shared.primitive.NonNullSupplier;
import net.shibboleth.shared.servlet.HttpServletSupport;
/**
@@ -377,14 +377,14 @@ public class StorageBackedAccountLockoutManager extends AbstractIdentifiableInit
public static class UsernameIPLockoutKeyStrategy implements Function<ProfileRequestContext,String> {
/** Supplier for the Servlet request to pull client ip from. **/
- @Nullable private Supplier<HttpServletRequest> httpRequestSupplier;
+ @Nullable private NonNullSupplier<HttpServletRequest> httpRequestSupplier;
/**
* Set the Supplier for the servlet request to read from.
*
* @param requestSupplier servlet request Supplier
*/
- public void setHttpServletRequestSupplier(@Nonnull final Supplier<HttpServletRequest> requestSupplier) {
+ public void setHttpServletRequestSupplier(@Nonnull final NonNullSupplier<HttpServletRequest> requestSupplier) {
httpRequestSupplier = Constraint.isNotNull(requestSupplier, "HttpServletRequest cannot be null");
}
diff --git a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/revocation/impl/RevocationCacheCondition.java b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/revocation/impl/RevocationCacheCondition.java
index 308b7d4d0..83d8bd0ca 100644
--- a/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/revocation/impl/RevocationCacheCondition.java
+++ b/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/revocation/impl/RevocationCacheCondition.java
@@ -23,11 +23,9 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.function.BiPredicate;
import java.util.function.Function;
-import java.util.function.Supplier;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
-import jakarta.servlet.http.HttpServletRequest;
import org.opensaml.messaging.context.ScratchContext;
import org.opensaml.profile.context.ProfileRequestContext;
@@ -35,6 +33,7 @@ import org.opensaml.storage.RevocationCache;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import jakarta.servlet.http.HttpServletRequest;
import net.shibboleth.idp.authn.AuthenticationResult;
import net.shibboleth.shared.annotation.constraint.NonnullAfterInit;
import net.shibboleth.shared.annotation.constraint.NonnullElements;
@@ -42,6 +41,7 @@ import net.shibboleth.shared.annotation.constraint.NotEmpty;
import net.shibboleth.shared.component.AbstractInitializableComponent;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.logic.Constraint;
+import net.shibboleth.shared.primitive.NonNullSupplier;
/**
* A condition for login flows that checks for revocation against a {@link RevocationCache}.
@@ -70,7 +70,7 @@ public class RevocationCacheCondition extends AbstractInitializableComponent
@NonnullAfterInit private Function<ProfileRequestContext,String> principalNameLookupStrategy;
/** Servlet request Supplier. */
- @Nullable private Supplier<HttpServletRequest> httpServletRequestSupplier;
+ @Nullable private NonNullSupplier<HttpServletRequest> httpServletRequestSupplier;
/**
* Set {@link RevocationCache} to use.
@@ -98,7 +98,7 @@ public class RevocationCacheCondition extends AbstractInitializableComponent
*
* @param supplier servlet request interface
*/
- public void setHttpServletRequestSupplier(@Nullable final Supplier<HttpServletRequest> supplier) {
+ public void setHttpServletRequestSupplier(@Nullable final NonNullSupplier<HttpServletRequest> supplier) {
checkSetterPreconditions();
httpServletRequestSupplier = supplier;
}
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 c0e808552..d74246400 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
@@ -18,6 +18,13 @@
package net.shibboleth.idp.authn.duo.impl;
+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.duo.DuoAuthAPI;
@@ -25,16 +32,7 @@ import net.shibboleth.idp.authn.duo.context.DuoAuthenticationContext;
import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
import net.shibboleth.idp.profile.testing.ActionTestingSupport;
import net.shibboleth.shared.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;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
+import net.shibboleth.shared.primitive.NonNullSupplier;
/** {@link ExtractDuoAuthenticationFromHeaders} unit test. */
public class ExtractDuoAuthenticationFromHeadersTest extends BaseAuthenticationContextTest {
@@ -46,7 +44,7 @@ public class ExtractDuoAuthenticationFromHeadersTest extends BaseAuthenticationC
action = new ExtractDuoAuthenticationFromHeaders();
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {public HttpServletRequest get() { return request;}});
action.initialize();
}
@@ -66,7 +64,7 @@ public class ExtractDuoAuthenticationFromHeadersTest extends BaseAuthenticationC
@Test public void testNoAuto() throws ComponentInitializationException {
action = new ExtractDuoAuthenticationFromHeaders();
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {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 817dbc3ec..ec1edf72d 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,10 +19,14 @@ package net.shibboleth.idp.authn.impl;
import java.util.Arrays;
-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;
+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.UsernameContext;
@@ -30,12 +34,7 @@ import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
import net.shibboleth.idp.profile.testing.ActionTestingSupport;
import net.shibboleth.shared.collection.Pair;
import net.shibboleth.shared.component.ComponentInitializationException;
-
-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 net.shibboleth.shared.primitive.NonNullSupplier;
/** {@link ExtractRemoteUser} unit test. */
public class ExtractRemoteUserTest extends BaseAuthenticationContextTest {
@@ -47,7 +46,7 @@ public class ExtractRemoteUserTest extends BaseAuthenticationContextTest {
action = new ExtractRemoteUser();
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {public HttpServletRequest get() { return request;}});
}
@Test public void testNoConfig() {
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 6f8df7411..ef84bcf9f 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,8 +18,6 @@
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;
@@ -33,6 +31,7 @@ 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.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.NonNullSupplier;
/** {@link ExtractUserAgentAddress} unit test. */
public class ExtractUserAgentAddressTest extends BaseAuthenticationContextTest {
@@ -44,7 +43,7 @@ public class ExtractUserAgentAddressTest extends BaseAuthenticationContextTest {
action = new ExtractUserAgentAddress();
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {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 784342b1f..598dab1db 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,8 +18,6 @@
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;
@@ -33,6 +31,7 @@ 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.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.NonNullSupplier;
/** {@link ExtractUserAgentIdentifier} unit test. */
public class ExtractUserAgentIdentifierTest extends BaseAuthenticationContextTest {
@@ -44,7 +43,7 @@ public class ExtractUserAgentIdentifierTest extends BaseAuthenticationContextTes
action = new ExtractUserAgentIdentifier();
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {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 d557357cf..8970d9957 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,8 +18,6 @@
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;
@@ -35,6 +33,7 @@ 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.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.NonNullSupplier;
/** {@link ExtractUsernamePasswordFromBasicAuth} unit test. */
public class ExtractUsernamePasswordFromBasicAuthTest extends BaseAuthenticationContextTest {
@@ -46,7 +45,7 @@ public class ExtractUsernamePasswordFromBasicAuthTest extends BaseAuthentication
action = new ExtractUsernamePasswordFromBasicAuth();
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}}); action.initialize();
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {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 d58f362c4..e86a07242 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,8 +18,6 @@
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;
@@ -33,6 +31,7 @@ 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.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.NonNullSupplier;
/** {@link ExtractUsernamePasswordFromFormRequest} unit test. */
public class ExtractUsernamePasswordFromFormRequestTest extends BaseAuthenticationContextTest {
@@ -46,7 +45,7 @@ public class ExtractUsernamePasswordFromFormRequestTest extends BaseAuthenticati
action.setUsernameFieldName("j_username");
action.setPasswordFieldName("j_password");
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {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 06758ca8e..25c689f96 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,7 +20,6 @@ package net.shibboleth.idp.authn.impl;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
-import java.util.function.Supplier;
import org.opensaml.security.x509.X509Support;
import org.springframework.mock.web.MockHttpServletRequest;
@@ -36,6 +35,7 @@ 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.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.NonNullSupplier;
/** {@link ExtractX509CertificateFromRequest} unit test. */
public class ExtractX509CertificateFromRequestTest extends BaseAuthenticationContextTest {
@@ -92,7 +92,7 @@ public class ExtractX509CertificateFromRequestTest extends BaseAuthenticationCon
action = new ExtractX509CertificateFromRequest();
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {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 f27cfc9ed..a1b1a5f80 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,7 +22,6 @@ 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;
@@ -47,6 +46,7 @@ import net.shibboleth.idp.authn.principal.impl.ExactPrincipalEvalPredicateFactor
import net.shibboleth.idp.authn.testing.TestPrincipal;
import net.shibboleth.idp.profile.testing.ActionTestingSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.NonNullSupplier;
/** Unit test for htpasswd file validation. */
public class HTPasswdCredentialValidatorTest extends BaseAuthenticationContextTest {
@@ -73,7 +73,7 @@ public class HTPasswdCredentialValidatorTest extends BaseAuthenticationContextTe
action.setClassifiedMessages(mappings);
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {public HttpServletRequest get() { return request;}});
}
@Test public void testMissingFlow() throws ComponentInitializationException {
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 97bae92b6..2ba51a7ca 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
@@ -17,6 +17,8 @@
package net.shibboleth.idp.authn.impl;
+import static org.testng.Assert.assertEquals;
+
import java.io.File;
import java.io.IOException;
import java.net.URISyntaxException;
@@ -26,7 +28,6 @@ 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;
@@ -54,10 +55,9 @@ import net.shibboleth.idp.profile.testing.ActionTestingSupport;
import net.shibboleth.shared.collection.Pair;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.net.URISupport;
+import net.shibboleth.shared.primitive.NonNullSupplier;
import net.shibboleth.shared.testing.InMemoryDirectory;
-import static org.testng.Assert.assertEquals;
-
/** Unit test for JAAS validation. */
public class JAASCredentialValidatorTest extends BaseAuthenticationContextTest {
@@ -109,7 +109,7 @@ public class JAASCredentialValidatorTest extends BaseAuthenticationContextTest {
action.setClassifiedMessages(mappings);
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {public HttpServletRequest get() { return request;}});
}
@Test public void testMissingFlow() throws ComponentInitializationException {
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 d3e2ccead..90f9f56e6 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
@@ -17,6 +17,8 @@
package net.shibboleth.idp.authn.impl;
+import static org.testng.Assert.assertEquals;
+
import java.time.ZonedDateTime;
import java.util.Arrays;
import java.util.Collection;
@@ -24,15 +26,14 @@ 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 org.ldaptive.DefaultConnectionFactory;
import org.ldaptive.auth.AccountState;
import org.ldaptive.auth.AuthenticationResultCode;
import org.ldaptive.auth.Authenticator;
-import org.ldaptive.auth.SimpleBindAuthenticationHandler;
import org.ldaptive.auth.SearchDnResolver;
+import org.ldaptive.auth.SimpleBindAuthenticationHandler;
import org.ldaptive.auth.ext.PasswordPolicyAccountState;
import org.ldaptive.control.PasswordPolicyControl;
import org.ldaptive.jaas.LdapPrincipal;
@@ -59,11 +60,10 @@ 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.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.NonNullSupplier;
import net.shibboleth.shared.testing.InMemoryDirectory;
import net.shibboleth.shared.testing.VelocityEngine;
-import static org.testng.Assert.assertEquals;
-
/** Unit test for LDAP credential validation. */
public class LDAPCredentialValidatorTest extends BaseAuthenticationContextTest {
@@ -134,7 +134,7 @@ public class LDAPCredentialValidatorTest extends BaseAuthenticationContextTest {
mappings.put("ExpiredPassword", Arrays.asList("PASSWORD_EXPIRED", "CHANGE_AFTER_RESET"));
action.setClassifiedMessages(mappings);
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {public HttpServletRequest get() { return request;}});
}
@Test public void testMissingFlow() throws ComponentInitializationException {
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 423599c8c..113121190 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
@@ -19,7 +19,6 @@ package net.shibboleth.idp.authn.impl;
import java.util.Arrays;
-import java.util.function.Supplier;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.webflow.execution.Event;
@@ -32,6 +31,7 @@ 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.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.NonNullSupplier;
/** {@link PreserveAuthenticationFlowState} unit test. */
public class PreserveAuthenticationFlowStateTest extends BaseAuthenticationContextTest {
@@ -43,7 +43,7 @@ public class PreserveAuthenticationFlowStateTest extends BaseAuthenticationConte
action = new PreserveAuthenticationFlowState();
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {public HttpServletRequest get() { return request;}});
action.setParameterNames(Arrays.asList("foo", "foo2"));
action.initialize();
}
@@ -61,7 +61,7 @@ public class PreserveAuthenticationFlowStateTest extends BaseAuthenticationConte
@Test public void testNoParameters() throws ComponentInitializationException {
action = new PreserveAuthenticationFlowState();
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {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/StorageBackedAccountLockoutManagerTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/StorageBackedAccountLockoutManagerTest.java
index b0112cb25..a6ab72275 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/StorageBackedAccountLockoutManagerTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/StorageBackedAccountLockoutManagerTest.java
@@ -19,7 +19,6 @@ package net.shibboleth.idp.authn.impl;
import java.time.Duration;
-import java.util.function.Supplier;
import org.opensaml.storage.impl.MemoryStorageService;
import org.springframework.mock.web.MockHttpServletRequest;
@@ -33,6 +32,7 @@ import net.shibboleth.idp.authn.context.UsernamePasswordContext;
import net.shibboleth.idp.authn.impl.StorageBackedAccountLockoutManager.UsernameIPLockoutKeyStrategy;
import net.shibboleth.idp.authn.impl.testing.BaseAuthenticationContextTest;
import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.NonNullSupplier;
/** {@link StorageBackedAccountLockoutManager} unit test. */
public class StorageBackedAccountLockoutManagerTest extends BaseAuthenticationContextTest {
@@ -48,7 +48,7 @@ public class StorageBackedAccountLockoutManagerTest extends BaseAuthenticationCo
final UsernameIPLockoutKeyStrategy keyStrategy = new UsernameIPLockoutKeyStrategy();
final HttpServletRequest request = (HttpServletRequest) src.getExternalContext().getNativeRequest();
- keyStrategy.setHttpServletRequestSupplier(new Supplier<>() {public HttpServletRequest get() {return request;}});
+ keyStrategy.setHttpServletRequestSupplier(new NonNullSupplier<>() {public HttpServletRequest get() {return request;}});
manager = new StorageBackedAccountLockoutManager();
manager.setId("test");
manager.setStorageService(ss);
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 a8307aff6..439cc70c9 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
@@ -17,13 +17,14 @@
package net.shibboleth.idp.authn.impl;
+import static org.testng.Assert.assertEquals;
+
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
-import java.util.function.Supplier;
import org.ldaptive.DefaultConnectionFactory;
import org.ldaptive.auth.AuthenticationResultCode;
@@ -51,11 +52,10 @@ 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.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.NonNullSupplier;
import net.shibboleth.shared.testing.InMemoryDirectory;
import net.shibboleth.shared.testing.VelocityEngine;
-import static org.testng.Assert.assertEquals;
-
/** Unit test for multiple credential validation. */
public class ValidateCredentialsTest extends BaseAuthenticationContextTest {
@@ -132,7 +132,7 @@ public class ValidateCredentialsTest extends BaseAuthenticationContextTest {
mappings.put("ExpiredPassword", Arrays.asList("PASSWORD_EXPIRED", "CHANGE_AFTER_RESET"));
action.setClassifiedMessages(mappings);
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {public HttpServletRequest get() { return request;}});
}
@Test public void testBadUsername() throws ComponentInitializationException {
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 9d7a7b8e6..5ceb35036 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,7 +20,6 @@ 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;
@@ -43,6 +42,7 @@ import net.shibboleth.idp.authn.principal.UsernamePrincipal;
import net.shibboleth.idp.authn.testing.TestPrincipal;
import net.shibboleth.idp.profile.testing.ActionTestingSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.NonNullSupplier;
/** {@link ValidateExternalAuthentication} unit test. */
public class ValidateExternalAuthenticationTest extends BaseAuthenticationContextTest {
@@ -60,7 +60,7 @@ public class ValidateExternalAuthenticationTest extends BaseAuthenticationContex
action = new ValidateExternalAuthentication();
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {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 800745049..a3143450b 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,7 +19,6 @@ 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;
@@ -35,6 +34,7 @@ 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.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.NonNullSupplier;
/** {@link ValidateRemoteUser} unit test. */
public class ValidateRemoteUserTest extends BaseAuthenticationContextTest {
@@ -49,7 +49,7 @@ public class ValidateRemoteUserTest extends BaseAuthenticationContextTest {
action.setDeniedUsernames(Arrays.asList("foo"));
action.setMatchExpression(Pattern.compile("^ba(r|z|n)$"));
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {public HttpServletRequest get() { return request;}});
action.initialize();
}
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 9a03614e4..62fc555a7 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,6 @@ 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;
@@ -41,6 +40,7 @@ import net.shibboleth.idp.authn.testing.TestPrincipal;
import net.shibboleth.idp.profile.testing.ActionTestingSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.net.IPRange;
+import net.shibboleth.shared.primitive.NonNullSupplier;
/** {@link ValidateUserAgentAddress} unit test. */
public class ValidateUserAgentAddressTest extends BaseAuthenticationContextTest {
@@ -55,7 +55,7 @@ public class ValidateUserAgentAddressTest extends BaseAuthenticationContextTest
"foo", Arrays.asList(IPRange.parseCIDRBlock("192.168.1.0/24"))));
action.setSupportedPrincipals(Arrays.asList(new TestPrincipal("UserAgentAuthentication")));
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {public HttpServletRequest get() { return request;}});
action.initialize();
}
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 e0dfbcec7..e60c010b8 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,7 +21,6 @@ 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;
@@ -44,6 +43,7 @@ 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.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.NonNullSupplier;
/** {@link X509CertificateCredentialValidator} unit test. */
public class X509CertificateCredentialValidatorTest extends BaseAuthenticationContextTest {
@@ -105,7 +105,7 @@ public class X509CertificateCredentialValidatorTest extends BaseAuthenticationCo
action = new ValidateCredentials();
action.setValidators(Collections.singletonList(validator));
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {public HttpServletRequest get() { return request;}});
action.initialize();
}
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 66b1b67c1..e81689373 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,8 +18,6 @@
package net.shibboleth.idp.authn.proxy.impl;
-import java.util.function.Supplier;
-
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.webflow.execution.Event;
import org.testng.Assert;
@@ -32,6 +30,7 @@ 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.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.NonNullSupplier;
/** {@link ExtractDiscoveryResponse} unit test. */
public class ExtractDiscoveryResponseTest extends BaseAuthenticationContextTest {
@@ -43,7 +42,7 @@ public class ExtractDiscoveryResponseTest extends BaseAuthenticationContextTest
action = new ExtractDiscoveryResponse();
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {public HttpServletRequest get() { return request;}});
action.initialize();
}
diff --git a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/spnego/impl/SPNEGOAutoLoginManagerTest.java b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/spnego/impl/SPNEGOAutoLoginManagerTest.java
index ebe102e23..f298d0a41 100644
--- a/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/spnego/impl/SPNEGOAutoLoginManagerTest.java
+++ b/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/spnego/impl/SPNEGOAutoLoginManagerTest.java
@@ -17,19 +17,18 @@
package net.shibboleth.idp.authn.spnego.impl;
-import jakarta.servlet.http.Cookie;
-import jakarta.servlet.http.HttpServletRequest;
-import jakarta.servlet.http.HttpServletResponse;
-import net.shibboleth.shared.net.CookieManager;
-
-import java.util.function.Supplier;
-
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.mock.web.MockHttpServletResponse;
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.shared.net.CookieManager;
+import net.shibboleth.shared.primitive.NonNullSupplier;
+
public class SPNEGOAutoLoginManagerTest {
/**
@@ -52,8 +51,8 @@ public class SPNEGOAutoLoginManagerTest {
final HttpServletRequest request = req != null ? req : new MockHttpServletRequest();
final HttpServletResponse response = res != null ? res : new MockHttpServletResponse();
- cookieManager.setHttpServletRequestSupplier(new Supplier<>() {public HttpServletRequest get() { return request;}});
- cookieManager.setHttpServletResponseSupplier(new Supplier<>() {public HttpServletResponse get() { return response;}});
+ cookieManager.setHttpServletRequestSupplier(new NonNullSupplier<>() {public HttpServletRequest get() { return request;}});
+ cookieManager.setHttpServletResponseSupplier(new NonNullSupplier<>() {public HttpServletResponse get() { return response;}});
cookieManager.initialize();
SPNEGOAutoLoginManager autoLoginManager = new SPNEGOAutoLoginManager();
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 5759989ca..77de64cdc 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,8 +17,6 @@
package net.shibboleth.idp.consent.flow.impl;
-import java.util.function.Supplier;
-
import org.opensaml.profile.action.EventIds;
import org.springframework.mock.web.MockHttpServletRequest;
import org.springframework.webflow.execution.Event;
@@ -31,6 +29,7 @@ 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 net.shibboleth.shared.primitive.NonNullSupplier;
/** {@link ExtractConsent} unit test. */
public class ExtractConsentTest extends AbstractConsentActionTest {
@@ -61,7 +60,7 @@ public class ExtractConsentTest extends AbstractConsentActionTest {
@Test public void testNoUserInput() throws Exception {
action = new ExtractConsent();
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {public HttpServletRequest get() { return request;}});
action.initialize();
final Event event = action.execute(src);
@@ -83,7 +82,7 @@ public class ExtractConsentTest extends AbstractConsentActionTest {
httpServletRequest.setParameter(ExtractConsent.CONSENT_IDS_REQUEST_PARAMETER, "consent1");
action = new ExtractConsent();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return httpServletRequest;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {public HttpServletRequest get() { return httpServletRequest;}});
action.initialize();
final Event event = action.execute(src);
@@ -106,7 +105,7 @@ public class ExtractConsentTest extends AbstractConsentActionTest {
httpServletRequest.addParameter(ExtractConsent.CONSENT_IDS_REQUEST_PARAMETER, "consent2");
action = new ExtractConsent();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return httpServletRequest;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {public HttpServletRequest get() { return httpServletRequest;}});
action.initialize();
final Event event = action.execute(src);
diff --git a/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerPropertiesImpl.java b/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerPropertiesImpl.java
index 80010fc06..eff78dd04 100644
--- a/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerPropertiesImpl.java
+++ b/idp-installer/src/main/java/net/shibboleth/idp/installer/InstallerPropertiesImpl.java
@@ -179,7 +179,7 @@ public class InstallerPropertiesImpl extends AbstractInitializableComponent impl
private String credentialsKeyFileMode;
/** Local overload of properties (to deal with nested calling). */
- private Map<String, String> inheritedProperties = Collections.EMPTY_MAP;
+ private Map<String, String> inheritedProperties = Collections.emptyMap();
/** Input handler from the prompting. */
private final InputHandler inputHandler;
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 b4ee71142..61cb707f3 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,7 +19,6 @@ package net.shibboleth.idp.profile.audit.impl;
import java.util.Collections;
import java.util.List;
-import java.util.function.Supplier;
import javax.annotation.Nonnull;
@@ -37,6 +36,7 @@ import net.shibboleth.idp.profile.context.navigate.WebflowRequestContextProfileR
import net.shibboleth.idp.profile.testing.ActionTestingSupport;
import net.shibboleth.idp.profile.testing.RequestContextBuilder;
import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.NonNullSupplier;
/** {@link WriteAuditLog} unit test. */
public class WriteAuditLogTest {
@@ -61,7 +61,7 @@ public class WriteAuditLogTest {
mock.setRequestURI("/path/to/foo");
action = new FilteringAction();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return mock;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {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 9e82d4f7a..51575a39a 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,7 +18,6 @@
package net.shibboleth.idp.saml.saml1.profile.impl;
import java.time.Instant;
-import java.util.function.Supplier;
import javax.security.auth.Subject;
@@ -50,6 +49,7 @@ import net.shibboleth.idp.profile.testing.RequestContextBuilder;
import net.shibboleth.idp.saml.authn.principal.AuthenticationMethodPrincipal;
import net.shibboleth.idp.saml.saml1.profile.testing.SAML1ActionTestingSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.NonNullSupplier;
/** {@link AddAuthenticationStatementToAssertion} unit test. */
public class AddAuthenticationStatementToAssertionTest extends OpenSAMLInitBaseTestCase {
@@ -67,7 +67,7 @@ public class AddAuthenticationStatementToAssertionTest extends OpenSAMLInitBaseT
action = new AddAuthenticationStatementToAssertion();
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {public HttpServletRequest get() { return request;}});
action.initialize();
}
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/IdPInitiatedSSORequestMessageDecoderTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/IdPInitiatedSSORequestMessageDecoderTest.java
index 5293f3e37..ee2c37823 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/IdPInitiatedSSORequestMessageDecoderTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml1/profile/impl/IdPInitiatedSSORequestMessageDecoderTest.java
@@ -19,7 +19,6 @@ package net.shibboleth.idp.saml.saml1.profile.impl;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
-import java.util.function.Supplier;
import org.opensaml.messaging.context.MessageContext;
import org.opensaml.messaging.decoder.MessageDecodingException;
@@ -35,6 +34,7 @@ import jakarta.servlet.http.HttpServletRequest;
import net.shibboleth.idp.saml.profile.impl.BaseIdPInitiatedSSORequestMessageDecoder;
import net.shibboleth.idp.saml.profile.impl.IdPInitiatedSSORequest;
import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.NonNullSupplier;
/**
* Test the {@link IdPInitiatedSSORequestMessageDecoder}.
@@ -67,7 +67,7 @@ public class IdPInitiatedSSORequestMessageDecoderTest {
request.setRequestedSessionId(sessionID);
decoder = new IdPInitiatedSSORequestMessageDecoder();
- decoder.setHttpServletRequestSupplier(new Supplier<>() {public HttpServletRequest get() { return request;}});
+ decoder.setHttpServletRequestSupplier(new NonNullSupplier<>() {public HttpServletRequest get() { return request;}});
decoder.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 641f274d7..b3db26f6e 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,7 +20,6 @@ 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;
@@ -56,6 +55,7 @@ import net.shibboleth.idp.saml.authn.principal.AuthnContextClassRefPrincipal;
import net.shibboleth.idp.saml.saml2.profile.config.BrowserSSOProfileConfiguration;
import net.shibboleth.idp.saml.saml2.profile.testing.SAML2ActionTestingSupport;
import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.NonNullSupplier;
/** {@link AddAuthnStatementToAssertion} unit test. */
@SuppressWarnings("javadoc")
@@ -74,7 +74,7 @@ public class AddAuthnStatementToAssertionTest extends OpenSAMLInitBaseTestCase {
action = new AddAuthnStatementToAssertion();
final MockHttpServletRequest request = new MockHttpServletRequest();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return request;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {public HttpServletRequest get() { return request;}});
action.initialize();
}
diff --git a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/IdPInitiatedSSORequestMessageDecoderTest.java b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/IdPInitiatedSSORequestMessageDecoderTest.java
index 4507ec27b..cd57cb143 100644
--- a/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/IdPInitiatedSSORequestMessageDecoderTest.java
+++ b/idp-saml-impl/src/test/java/net/shibboleth/idp/saml/saml2/profile/impl/IdPInitiatedSSORequestMessageDecoderTest.java
@@ -19,7 +19,6 @@ package net.shibboleth.idp.saml.saml2.profile.impl;
import java.time.Instant;
import java.time.temporal.ChronoUnit;
-import java.util.function.Supplier;
import org.opensaml.core.testing.XMLObjectBaseTestCase;
import org.opensaml.messaging.context.MessageContext;
@@ -36,6 +35,7 @@ import org.testng.annotations.Test;
import jakarta.servlet.http.HttpServletRequest;
import net.shibboleth.idp.saml.profile.impl.BaseIdPInitiatedSSORequestMessageDecoder;
import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.NonNullSupplier;
/**
* Test the {@link IdPInitiatedSSORequestMessageDecoder}.
@@ -68,7 +68,7 @@ public class IdPInitiatedSSORequestMessageDecoderTest extends XMLObjectBaseTestC
request.setRequestedSessionId(sessionID);
decoder = new IdPInitiatedSSORequestMessageDecoder();
- decoder.setHttpServletRequestSupplier(new Supplier<>() {public HttpServletRequest get() { return request;}});
+ decoder.setHttpServletRequestSupplier(new NonNullSupplier<>() {public HttpServletRequest get() { return request;}});
decoder.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 0171ecb64..fd8b165f9 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,7 +22,6 @@ 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;
@@ -53,6 +52,7 @@ import jakarta.servlet.http.HttpServletResponse;
import net.shibboleth.idp.authn.AuthnEventIds;
import net.shibboleth.idp.authn.context.AuthenticationContext;
import net.shibboleth.shared.component.ComponentInitializationException;
+import net.shibboleth.shared.primitive.NonNullSupplier;
public class ProcessAssertionsForAuthenticationTest extends OpenSAMLInitBaseTestCase {
@@ -73,8 +73,8 @@ public class ProcessAssertionsForAuthenticationTest extends OpenSAMLInitBaseTest
httpResponse = new MockHttpServletResponse();
action = new ProcessAssertionsForAuthentication();
- action.setHttpServletRequestSupplier(new Supplier<> () {public HttpServletRequest get() { return httpRequest;}});
- action.setHttpServletResponseSupplier(new Supplier<> () {public HttpServletResponse get() { return httpResponse;}});
+ action.setHttpServletRequestSupplier(new NonNullSupplier<> () {public HttpServletRequest get() { return httpRequest;}});
+ action.setHttpServletResponseSupplier(new NonNullSupplier<> () {public HttpServletResponse get() { return httpResponse;}});
samlResponse = SAML2ActionTestingSupport.buildResponse();
diff --git a/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedSessionManager.java b/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedSessionManager.java
index 441577807..af6617e35 100644
--- a/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedSessionManager.java
+++ b/idp-session-impl/src/main/java/net/shibboleth/idp/session/impl/StorageBackedSessionManager.java
@@ -26,7 +26,6 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Objects;
import java.util.function.BiPredicate;
-import java.util.function.Supplier;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@@ -60,6 +59,7 @@ import net.shibboleth.shared.component.AbstractIdentifiableInitializableComponen
import net.shibboleth.shared.component.ComponentInitializationException;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.net.CookieManager;
+import net.shibboleth.shared.primitive.NonNullSupplier;
import net.shibboleth.shared.primitive.StringSupport;
import net.shibboleth.shared.resolver.CriteriaSet;
import net.shibboleth.shared.resolver.ResolverException;
@@ -120,7 +120,7 @@ public class StorageBackedSessionManager extends AbstractIdentifiableInitializab
@Nonnull private final Logger log = LoggerFactory.getLogger(StorageBackedSessionManager.class);
/** Servlet request to read from. */
- @Nullable private Supplier<HttpServletRequest> httpRequestSupplier;
+ @Nullable private NonNullSupplier<HttpServletRequest> httpRequestSupplier;
/** Inactivity timeout for sessions. */
@Nonnull private Duration sessionTimeout;
@@ -184,7 +184,7 @@ public class StorageBackedSessionManager extends AbstractIdentifiableInitializab
*
* @param requestSupplier servlet request Supplier
*/
- public void setHttpServletRequestSupplier(@Nullable final Supplier<HttpServletRequest> requestSupplier) {
+ public void setHttpServletRequestSupplier(@Nullable final NonNullSupplier<HttpServletRequest> requestSupplier) {
checkSetterPreconditions();
httpRequestSupplier = requestSupplier;
diff --git a/idp-ui/src/main/java/net/shibboleth/idp/ui/context/RelyingPartyUIContext.java b/idp-ui/src/main/java/net/shibboleth/idp/ui/context/RelyingPartyUIContext.java
index d11fc3f2f..d882ab784 100644
--- a/idp-ui/src/main/java/net/shibboleth/idp/ui/context/RelyingPartyUIContext.java
+++ b/idp-ui/src/main/java/net/shibboleth/idp/ui/context/RelyingPartyUIContext.java
@@ -27,7 +27,6 @@ import java.util.List;
import java.util.Locale;
import java.util.Locale.LanguageRange;
import java.util.Map;
-import java.util.function.Supplier;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
@@ -57,8 +56,9 @@ import net.shibboleth.shared.annotation.constraint.NotLive;
import net.shibboleth.shared.annotation.constraint.Unmodifiable;
import net.shibboleth.shared.logic.Constraint;
import net.shibboleth.shared.primitive.DeprecationSupport;
-import net.shibboleth.shared.primitive.StringSupport;
import net.shibboleth.shared.primitive.DeprecationSupport.ObjectType;
+import net.shibboleth.shared.primitive.NonNullSupplier;
+import net.shibboleth.shared.primitive.StringSupport;
import net.shibboleth.shared.spring.util.SpringSupport;
/**
@@ -89,7 +89,7 @@ public final class RelyingPartyUIContext extends BaseContext {
/** A way of getting the current HTTP request, if available.
* Used to define dynamically selected languages. */
- @Nullable private Supplier<HttpServletRequest> requestSupplier;
+ @Nullable private NonNullSupplier<HttpServletRequest> requestSupplier;
/** Constructor. */
public RelyingPartyUIContext() {
@@ -231,7 +231,7 @@ public final class RelyingPartyUIContext extends BaseContext {
* @param what what to set.
* @return this context
*/
- public RelyingPartyUIContext setRequestSupplier(@Nonnull final Supplier<HttpServletRequest> what) {
+ public RelyingPartyUIContext setRequestSupplier(@Nonnull final NonNullSupplier<HttpServletRequest> what) {
requestSupplier = what;
return this;
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list