[java-idp-plugin-oidc-rp] branch main updated: Switch to internal versions of the HttpServletXXX proxies

Phil Smart philip.smart at jisc.ac.uk
Fri Nov 18 14:31:16 UTC 2022


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

philsmart pushed a commit to branch main
in repository java-idp-plugin-oidc-rp.

View the commit online:
http://git.shibboleth.net/view/?p=java-idp-plugin-oidc-rp.git;a=commit;h=5c15aed291a3788cdddb62dc190ea7afbf7f946c

The following commit(s) were added to refs/heads/main by this push:
     new 5c15aed  Switch to internal versions of the HttpServletXXX proxies
5c15aed is described below

commit 5c15aed291a3788cdddb62dc190ea7afbf7f946c
Author: Phil Smart <philip.smart at jisc.ac.uk>
AuthorDate: Fri Nov 18 14:31:10 2022 +0000

    Switch to internal versions of the HttpServletXXX proxies
    
     - ease transition to IdP 4.3. See IDP-2042
---
 .../resources/META-INF/net.shibboleth.idp/postconfig.xml | 12 +++++++++++-
 .../OIDCRelyingParty/oidc-relying-party-authn-beans.xml  | 16 ++++++++--------
 .../test/flow/AbstractAuthnXmlFlowExecutionTests.java    | 13 +++++--------
 3 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/idp-oidc-rp-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml b/idp-oidc-rp-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
index ea3b8c1..2e2c4e3 100644
--- a/idp-oidc-rp-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
+++ b/idp-oidc-rp-impl/src/main/resources/META-INF/net.shibboleth.idp/postconfig.xml
@@ -17,6 +17,16 @@
     <bean id="shibboleth.authn.oidc.rp.ExpiringJWKCredential" abstract="true"
         class="net.shibboleth.oidc.security.impl.BasicExpiringJWTSharedSecretCredentialFactoryBean"
         p:credentialExpiresAt="%{idp.authn.oidc.rp.client.clientSecretExpiresAt:PT0S}" />
+        
+        
+    <!-- 
+        Internal versions of the Http Request/Reponse proxies to easy the transition to IdP 5.0.
+        Will be removed in IdP 5.0. 
+    -->
+    <bean id="shibboleth.authn.oidc.rp.internal.HttpServletRequest"
+        class="net.shibboleth.utilities.java.support.net.ThreadLocalHttpServletRequestProxy" lazy-init="true" />
+    <bean id="shibboleth.authn.oidc.rp.internal.HttpServletResponse"
+        class="net.shibboleth.utilities.java.support.net.ThreadLocalHttpServletResponseProxy" lazy-init="true" />
 
     <!-- Functions use by the flow and global beans -->
 
@@ -396,7 +406,7 @@
         </property>
     </bean>
      
-     <bean id="shibboleth.authn.oidc.rp.DefaultAuthenticationResponseAuditExtractors" lazy-init="true"
+    <bean id="shibboleth.authn.oidc.rp.DefaultAuthenticationResponseAuditExtractors" lazy-init="true"
             class="org.springframework.beans.factory.config.MapFactoryBean">
         <property name="sourceMap">
             <map>
diff --git a/idp-oidc-rp-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/OIDCRelyingParty/oidc-relying-party-authn-beans.xml b/idp-oidc-rp-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/OIDCRelyingParty/oidc-relying-party-authn-beans.xml
index ab3b8db..2bb1f15 100644
--- a/idp-oidc-rp-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/OIDCRelyingParty/oidc-relying-party-authn-beans.xml
+++ b/idp-oidc-rp-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/authn/OIDCRelyingParty/oidc-relying-party-authn-beans.xml
@@ -126,7 +126,7 @@
                             p:requestedClaimsHook="#{getObject('shibboleth.authn.oidc.rp.RequestedClaimsHook')}" />
                         <bean id="AddRedirectURI" scope="prototype"
                             class="net.shibboleth.idp.plugin.authn.oidc.rp.messaging.impl.AddRedirectURIHandler"
-                            p:httpServletRequest-ref="shibboleth.HttpServletRequest"
+                            p:httpServletRequest-ref="shibboleth.authn.oidc.rp.internal.HttpServletRequest"
                             p:redirectUriCreationStrategy="#{getObject('shibboleth.authn.oidc.rp.RedirectUriCreationStrategy') ?: 
                                 getObject('shibboleth.authn.oidc.rp.DefaultRedirectUriCreationStrategy')}" />
                         <bean id="AddAuthenticationContextClassReferences" scope="prototype"
@@ -152,7 +152,7 @@
         p:formattingMap-ref="shibboleth.AuditFormattingMap"
         p:dateTimeFormat="#{getObject('shibboleth.AuditDateTimeFormat')}"
         p:useDefaultTimeZone="#{getObject('shibboleth.AuditDefaultTimeZone') ?: false}"
-        p:httpServletRequest-ref="shibboleth.HttpServletRequest" />
+        p:httpServletRequest-ref="shibboleth.authn.oidc.rp.internal.HttpServletRequest" />
 
 
     <!-- Build RequestObject if required -->
@@ -248,17 +248,17 @@
 
     <bean id="HTTPRedirectAuthnRequestEncoder"
         class="net.shibboleth.oidc.profile.encoder.impl.HTTPRedirectAuthnRequestEncoder" init-method=""
-        scope="prototype" p:httpServletResponse-ref="shibboleth.HttpServletResponse"
+        scope="prototype" p:httpServletResponse-ref="shibboleth.authn.oidc.rp.internal.HttpServletResponse"
         p:authorizationParamsAreValidPredicate="#{getObject('shibboleth.authn.oidc.rp.AuthzParamsValidPredicate')}" />
 
     <bean id="HTTPPostAuthnRequestEncoder"
         class="net.shibboleth.oidc.profile.encoder.impl.HTTPPostAuthnRequestEncoder" init-method="" scope="prototype"
-        p:velocityEngine-ref="shibboleth.VelocityEngine" p:httpServletResponse-ref="shibboleth.HttpServletResponse"
+        p:velocityEngine-ref="shibboleth.VelocityEngine" p:httpServletResponse-ref="shibboleth.authn.oidc.rp.internal.HttpServletResponse"
         p:authorizationParamsAreValidPredicate="#{getObject('shibboleth.authn.oidc.rp.AuthzParamsValidPredicate')}" />
 
 
     <bean id="EncodeMessage" class="org.opensaml.profile.action.impl.EncodeMessage" scope="prototype"
-        p:messageEncoderFactory-ref="messageEncoderFactory" p:httpServletResponse-ref="shibboleth.HttpServletResponse" />
+        p:messageEncoderFactory-ref="messageEncoderFactory" p:httpServletResponse-ref="shibboleth.authn.oidc.rp.internal.HttpServletResponse" />
 
     <bean id="PreEncodeMessageHandler" class="org.opensaml.messaging.handler.impl.BasicMessageHandlerChain"
         scope="prototype">
@@ -317,11 +317,11 @@
 
     <bean id="OIDCRedirectAuthnResponseDecoder"
         class="net.shibboleth.oidc.profile.decoding.impl.HTTPRedirectAuthnResponseDecoder" init-method=""
-        scope="prototype" p:httpServletRequest-ref="shibboleth.HttpServletRequest" />
+        scope="prototype" p:httpServletRequest-ref="shibboleth.authn.oidc.rp.internal.HttpServletRequest" />
 
     <bean id="OIDCPostAuthnResponseDecoder"
         class="net.shibboleth.oidc.profile.decoding.impl.HTTPPostAuthnResponseDecoder" init-method="" scope="prototype"
-        p:httpServletRequest-ref="shibboleth.HttpServletRequest" />
+        p:httpServletRequest-ref="shibboleth.authn.oidc.rp.internal.HttpServletRequest" />
 
 
 
@@ -885,7 +885,7 @@
         p:formattingMap-ref="shibboleth.AuditFormattingMap"
         p:dateTimeFormat="#{getObject('shibboleth.AuditDateTimeFormat')}"
         p:useDefaultTimeZone="#{getObject('shibboleth.AuditDefaultTimeZone') ?: false}"
-        p:httpServletRequest-ref="shibboleth.HttpServletRequest" />
+        p:httpServletRequest-ref="shibboleth.authn.oidc.rp.internal.HttpServletRequest" />
 
 
 
diff --git a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/test/flow/AbstractAuthnXmlFlowExecutionTests.java b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/test/flow/AbstractAuthnXmlFlowExecutionTests.java
index 2f5d05c..c2cbc53 100644
--- a/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/test/flow/AbstractAuthnXmlFlowExecutionTests.java
+++ b/idp-oidc-rp-impl/src/test/java/net/shibboleth/idp/plugin/authn/test/flow/AbstractAuthnXmlFlowExecutionTests.java
@@ -77,13 +77,13 @@ import net.shibboleth.idp.authn.context.AuthenticationContext;
 import net.shibboleth.idp.authn.context.SubjectCanonicalizationContext;
 import net.shibboleth.idp.plugin.authn.test.spring.CustomAbstractXmlFlowExecutionTests;
 import net.shibboleth.idp.plugin.authn.test.spring.CustomFlowModelFlowBuilder;
-import net.shibboleth.idp.plugin.authn.test.spring.CustomFlowRelativeResourceLoader;
 import net.shibboleth.idp.profile.context.navigate.WebflowRequestContextProfileRequestContextLookup;
 import net.shibboleth.idp.session.IdPSession;
 import net.shibboleth.idp.session.context.SessionContext;
 import net.shibboleth.idp.ui.context.RelyingPartyUIContext;
 import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
 import net.shibboleth.utilities.java.support.annotation.constraint.NotEmpty;
+import net.shibboleth.utilities.java.support.net.HttpServletRequestResponseContext;
 import net.shibboleth.utilities.java.support.security.impl.SecureRandomIdentifierGenerationStrategy;
 import net.shibboleth.utilities.java.support.xml.DOMTypeSupport;
 
@@ -292,8 +292,8 @@ public abstract class AbstractAuthnXmlFlowExecutionTests extends CustomAbstractX
         
         builderContext.registerBean("shibboleth.DefaultIdentifierGenerationStrategy", 
                 new SecureRandomIdentifierGenerationStrategy());
-        builderContext.registerBean("shibboleth.HttpServletRequest",mockRequest);
-        builderContext.registerBean("shibboleth.HttpServletResponse", mockResponse);      
+        // Load the request and final response context into the holder.
+        HttpServletRequestResponseContext.loadCurrent(mockRequest, mockResponse);    
         builderContext.registerBean("shibboleth.PostLoginSubjectCanonicalizationFlows", Collections.emptyList());
 
         //create a real JSON parser
@@ -375,10 +375,7 @@ public abstract class AbstractAuthnXmlFlowExecutionTests extends CustomAbstractX
                 genericBeanDefinition(net.shibboleth.utilities.java.support.logic.FunctionSupport.class)
                 .setParentName("shibboleth.Functions.Compose")
                 .addConstructorArgReference("shibboleth.Functions.ProxyProfileRequestAuthenticationContext")
-                .addConstructorArgValue(new WebflowRequestContextProfileRequestContextLookup()).getBeanDefinition());
-        
-        // Setup the audit context
-        
+                .addConstructorArgValue(new WebflowRequestContextProfileRequestContextLookup()).getBeanDefinition());        
                        
     }
     
@@ -507,7 +504,7 @@ public abstract class AbstractAuthnXmlFlowExecutionTests extends CustomAbstractX
      * @return a set of converters.
      */
     private Set<Converter<?, ?>> createConverters(){
-        final Converter<String,Duration> durationConverter = new Converter<String,Duration>(){
+        final Converter<String,Duration> durationConverter = new Converter<>(){
 
             @Override
             public Duration convert(final String source) {

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


More information about the commits mailing list