[java-identity-provider] branch dev/4/IDP-1793 updated: IDP-1793 Use Suppliers for HttpRequest/Response

Rod Widdowson rdw at steadingsoftware.com
Thu Jul 28 19:18:34 UTC 2022


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

rdw pushed a commit to branch dev/4/IDP-1793
in repository java-identity-provider.

View the commit online:
http://git.shibboleth.net/view/?p=java-identity-provider.git;a=commit;h=78a130956e764a30ec6fc328edfc56a003c42521

The following commit(s) were added to refs/heads/dev/4/IDP-1793 by this push:
     new 78a130956 IDP-1793 Use Suppliers for HttpRequest/Response
78a130956 is described below

commit 78a130956e764a30ec6fc328edfc56a003c42521
Author: Rod Widdowson <rdw at steadingsoftware.com>
AuthorDate: Thu Jul 28 20:15:03 2022 +0100

    IDP-1793 Use Suppliers for HttpRequest/Response
    
    https://shibboleth.atlassian.net/browse/IDP-1793
    
    Inject the Supplier directly into the RelyingPartyUIContext
---
 .../impl/InitializeAdministrativeProfileContextTree.java  | 15 ++-------------
 .../net/shibboleth/idp/ui/impl/SetRPUIInformation.java    | 15 ++-------------
 2 files changed, 4 insertions(+), 26 deletions(-)

diff --git a/idp-admin-impl/src/main/java/net/shibboleth/idp/admin/impl/InitializeAdministrativeProfileContextTree.java b/idp-admin-impl/src/main/java/net/shibboleth/idp/admin/impl/InitializeAdministrativeProfileContextTree.java
index f90b71b2e..83818f4f3 100644
--- a/idp-admin-impl/src/main/java/net/shibboleth/idp/admin/impl/InitializeAdministrativeProfileContextTree.java
+++ b/idp-admin-impl/src/main/java/net/shibboleth/idp/admin/impl/InitializeAdministrativeProfileContextTree.java
@@ -18,11 +18,9 @@
 package net.shibboleth.idp.admin.impl;
 
 import java.util.List;
-import java.util.function.Supplier;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
-import javax.servlet.http.HttpServletRequest;
 
 import org.opensaml.profile.action.ActionSupport;
 import org.opensaml.profile.context.ProfileRequestContext;
@@ -37,7 +35,6 @@ import net.shibboleth.idp.profile.context.RelyingPartyContext;
 import net.shibboleth.idp.ui.context.RelyingPartyUIContext;
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
 import net.shibboleth.utilities.java.support.component.ComponentSupport;
-import net.shibboleth.utilities.java.support.net.ThreadLocalHttpServletRequestProxy;
 
 /**
  * An action that processes settings from a supplied {@link AdministrativeFlowDescriptor} to prepare
@@ -124,16 +121,8 @@ public class InitializeAdministrativeProfileContextTree extends AbstractProfileA
         
         final RelyingPartyUIContext uiCtx = rpCtx.getSubcontext(RelyingPartyUIContext.class, true);
         uiCtx.setRPUInfo(flowDescriptor.getUIInfo());
-        final HttpServletRequest request = getHttpServletRequest();
-        uiCtx.setBrowserLanguageRanges(SpringSupport.getLanguageRange(request));
-        if (request instanceof ThreadLocalHttpServletRequestProxy) {
-            // The request is delegated so can be put into a Supplier
-            uiCtx.setRequestSupplier(new Supplier<HttpServletRequest>() {
-                public HttpServletRequest get() {
-                    return request;
-                }
-            });
-        }
+        uiCtx.setBrowserLanguageRanges(SpringSupport.getLanguageRange(getHttpServletRequest()));
+        uiCtx.setRequestSupplier(getHttpServletRequestSupplier());
         
         if (null != fallbackLanguages) {
             uiCtx.setFallbackLanguages(fallbackLanguages);
diff --git a/idp-ui/src/main/java/net/shibboleth/idp/ui/impl/SetRPUIInformation.java b/idp-ui/src/main/java/net/shibboleth/idp/ui/impl/SetRPUIInformation.java
index 156f3d045..ab1040fe7 100644
--- a/idp-ui/src/main/java/net/shibboleth/idp/ui/impl/SetRPUIInformation.java
+++ b/idp-ui/src/main/java/net/shibboleth/idp/ui/impl/SetRPUIInformation.java
@@ -19,11 +19,9 @@ package net.shibboleth.idp.ui.impl;
 
 import java.util.List;
 import java.util.function.Function;
-import java.util.function.Supplier;
 
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
-import javax.servlet.http.HttpServletRequest;
 
 import org.opensaml.core.xml.XMLObject;
 import org.opensaml.messaging.context.navigate.ChildContextLookup;
@@ -49,7 +47,6 @@ import net.shibboleth.idp.ui.context.RelyingPartyUIContext;
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
 import net.shibboleth.utilities.java.support.component.ComponentSupport;
 import net.shibboleth.utilities.java.support.logic.Constraint;
-import net.shibboleth.utilities.java.support.net.ThreadLocalHttpServletRequestProxy;
 import net.shibboleth.utilities.java.support.primitive.StringSupport;
 
 /**
@@ -216,16 +213,8 @@ public class SetRPUIInformation extends AbstractProfileAction {
         rpUIContext.setRPSPSSODescriptor(spSSODescriptor);
         rpUIContext.setRPAttributeConsumingService(acsDesriptor);
         rpUIContext.setRPUInfo(getRPUInfo());
-        final HttpServletRequest request = getHttpServletRequest();
-        rpUIContext.setBrowserLanguageRanges(SpringSupport.getLanguageRange(request));
-        if (request instanceof ThreadLocalHttpServletRequestProxy) {
-            // The request is delegated so can be put into a Supplier
-            rpUIContext.setRequestSupplier(new Supplier<HttpServletRequest>() {
-                public HttpServletRequest get() {
-                    return request;
-                }
-            });
-        }
+        rpUIContext.setBrowserLanguageRanges(SpringSupport.getLanguageRange(getHttpServletRequest()));
+        rpUIContext.setRequestSupplier(getHttpServletRequestSupplier());
    }
 
 }

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


More information about the commits mailing list