[java-idp-testbed] branch main updated: Use ConstantSupplier

Rod Widdowson rdw at steadingsoftware.com
Sat Nov 26 15:43:59 UTC 2022


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

rdw pushed a commit to branch main
in repository java-idp-testbed.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-testbed.git;a=commit;h=a7864cf1c2a168b74f2c9192226581824d8266c1

The following commit(s) were added to refs/heads/main by this push:
     new a7864cf  Use ConstantSupplier
a7864cf is described below

commit a7864cf1c2a168b74f2c9192226581824d8266c1
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Sat Nov 26 15:43:52 2022 +0000

    Use ConstantSupplier
---
 pom.xml                                  | 2 --
 src/main/java/sp/BaseSAMLController.java | 7 ++-----
 src/main/java/sp/SAML2Controller.java    | 8 ++------
 3 files changed, 4 insertions(+), 13 deletions(-)

diff --git a/pom.xml b/pom.xml
index 54e2949..557649a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -158,12 +158,10 @@
             <scope>runtime</scope>
         </dependency>
 
-        <!-- InMemoryDirectoryServer -->
         <dependency>
             <groupId>net.shibboleth</groupId>
             <artifactId>shib-testing</artifactId>
             <version>${shib-shared.version}</version>
-            <scope>runtime</scope>
         </dependency>
 
         <!-- Don't know why we have to directly include this. -->
diff --git a/src/main/java/sp/BaseSAMLController.java b/src/main/java/sp/BaseSAMLController.java
index 626874f..2cc5e4d 100644
--- a/src/main/java/sp/BaseSAMLController.java
+++ b/src/main/java/sp/BaseSAMLController.java
@@ -39,6 +39,7 @@ import net.shibboleth.shared.component.ComponentInitializationException;
 import net.shibboleth.shared.primitive.NonnullSupplier;
 import net.shibboleth.shared.security.IdentifierGenerationStrategy;
 import net.shibboleth.shared.security.IdentifierGenerationStrategy.ProviderType;
+import net.shibboleth.shared.testing.ConstantSupplier;
 import net.shibboleth.shared.xml.ParserPool;
 
 public abstract class BaseSAMLController {
@@ -62,11 +63,7 @@ public abstract class BaseSAMLController {
     @Autowired protected ApplicationContext applicationContext;
 
     private void setRequest(final BaseHttpServletRequestXMLMessageDecoder decoder, final HttpServletRequest servletRequest) {
-        decoder.setHttpServletRequestSupplier(new NonnullSupplier<>() {
-            public HttpServletRequest get() {
-                return servletRequest;
-            }
-        });
+        decoder.setHttpServletRequestSupplier(new ConstantSupplier<>(servletRequest));
     }
     
     protected MessageContext decodeInboundMessageContextPost(HttpServletRequest servletRequest)
diff --git a/src/main/java/sp/SAML2Controller.java b/src/main/java/sp/SAML2Controller.java
index eb91269..d305d4e 100644
--- a/src/main/java/sp/SAML2Controller.java
+++ b/src/main/java/sp/SAML2Controller.java
@@ -94,10 +94,10 @@ import jakarta.servlet.http.HttpServletResponse;
 import net.shibboleth.shared.annotation.constraint.NotEmpty;
 import net.shibboleth.shared.component.ComponentInitializationException;
 import net.shibboleth.shared.net.URLBuilder;
-import net.shibboleth.shared.primitive.NonnullSupplier;
 import net.shibboleth.shared.primitive.StringSupport;
 import net.shibboleth.shared.security.IdentifierGenerationStrategy;
 import net.shibboleth.shared.security.IdentifierGenerationStrategy.ProviderType;
+import net.shibboleth.shared.testing.ConstantSupplier;
 import net.shibboleth.shared.xml.SerializeSupport;
 import net.shibboleth.shared.xml.XMLParserException;
 
@@ -398,11 +398,7 @@ public class SAML2Controller extends BaseSAMLController {
 	}
 
     private void setupResponse(final AbstractHttpServletResponseMessageEncoder encoder, final HttpServletResponse response) {
-        encoder.setHttpServletResponseSupplier(new NonnullSupplier<>() {
-            public HttpServletResponse get() {
-                return response;
-            }
-        });
+        encoder.setHttpServletResponseSupplier(new ConstantSupplier<>(response));
     }
 
 	private void encodeOutboundMessageContextRedirect(MessageContext messageContext, HttpServletResponse servletResponse) throws Exception {

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


More information about the commits mailing list