[java-plugin-shibd] branch main updated: Additional adapter class and error handling fixes.

Scott Cantor cantor.2 at osu.edu
Thu Oct 3 16:46:57 UTC 2024


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

scantor pushed a commit to branch main
in repository java-plugin-shibd.

View the commit online:
http://git.shibboleth.net/view/?p=java-plugin-shibd.git;a=commit;h=da8343e245a7d57d4ffc6feda853d3bdae93c8af

The following commit(s) were added to refs/heads/main by this push:
     new da8343e  Additional adapter class and error handling fixes.
da8343e is described below

commit da8343e245a7d57d4ffc6feda853d3bdae93c8af
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Oct 3 12:46:54 2024 -0400

    Additional adapter class and error handling fixes.
---
 .../idp/flows/sp/consumer/consumer-flow.xml        |  2 +
 .../profile/impl/WebFlowMessageHandlerAdaptor.java | 56 ++++++++++++++++++++++
 2 files changed, 58 insertions(+)

diff --git a/sp-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/consumer/consumer-flow.xml b/sp-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/consumer/consumer-flow.xml
index d7b2d84..0dd581b 100644
--- a/sp-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/consumer/consumer-flow.xml
+++ b/sp-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/consumer/consumer-flow.xml
@@ -13,6 +13,7 @@
 
     <!-- Error events to reflect back from this subflow. -->
     <end-state id="InvalidEvent" />
+    <end-state id="InvalidMessage" />
     <end-state id="InvalidProfileContext" />
     <end-state id="InvalidProfileConfiguration" />
     <end-state id="InvalidRelyingPartyContext" />
@@ -33,6 +34,7 @@
     <global-transitions>
         <transition on-exception="java.lang.RuntimeException" to="LogRuntimeException" />
         <transition on="InvalidProfileContext" to="InvalidProfileContext" />
+        <transition on="InvalidMessage" to="InvalidMessage" />
         <transition on="InvalidProfileConfiguration" to="InvalidProfileConfiguration" />
         <transition on="InvalidRelyingPartyContext" to="InvalidRelyingPartyContext" />
         <transition on="InvalidRelyingPartyConfiguration" to="InvalidRelyingPartyConfiguration" />
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/WebFlowMessageHandlerAdaptor.java b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/WebFlowMessageHandlerAdaptor.java
new file mode 100644
index 0000000..3980570
--- /dev/null
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/WebFlowMessageHandlerAdaptor.java
@@ -0,0 +1,56 @@
+/*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *    http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package net.shibboleth.sp.profile.impl;
+
+import javax.annotation.Nonnull;
+
+import org.opensaml.messaging.handler.MessageHandler;
+import org.opensaml.profile.context.ProfileRequestContext;
+
+import net.shibboleth.sp.context.AgentRequestContext;
+import net.shibboleth.sp.messaging.RemotedHttpServletRequestResponseContext;
+
+/**
+ * Subclass of adaptor that populates thread-local remoted servlet request/resoonse objects.
+ */
+public class WebFlowMessageHandlerAdaptor extends net.shibboleth.idp.profile.impl.WebFlowMessageHandlerAdaptor {
+
+    /**
+     * Constructor.
+     *
+     * @param messageHandler message handleer to run
+     * @param executionDirection handler direction
+     */
+    public WebFlowMessageHandlerAdaptor(@Nonnull final MessageHandler messageHandler,
+            @Nonnull final Direction executionDirection) {
+        super(messageHandler, executionDirection);
+    }
+
+    /** {@inheritDoc} */
+    @Override
+    public void doExecute(@Nonnull final ProfileRequestContext profileRequestContext) {
+        final AgentRequestContext agentRequestContext =
+                profileRequestContext.ensureSubcontext(AgentRequestContext.class);
+        
+        try {
+            RemotedHttpServletRequestResponseContext.loadCurrent(agentRequestContext.getRemotedHttpServletRequest(),
+                    agentRequestContext.getRemotedHttpServletResponse());
+            super.doExecute(profileRequestContext);
+        } finally {
+            RemotedHttpServletRequestResponseContext.clearCurrent();
+        }
+    }
+    
+}
\ 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