[java-plugin-shibd] branch dev/StateMgmtWIP updated: Remove extraneous state and add passive detection to error handler.

Codeberg noreply at shibboleth.net
Tue Apr 28 17:41:45 UTC 2026


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

codeberg pushed a commit to branch dev/StateMgmtWIP
in repository java-plugin-shibd.

View the commit online:
https://codeberg.org/Shibboleth/java-plugin-shibd/commit/d7095831371cdb041f3f73d3976f0cf04f2cd43e

The following commit(s) were added to refs/heads/dev/StateMgmtWIP by this push:
     new d709583  Remove extraneous state and add passive detection to error handler.
d709583 is described below

commit d7095831371cdb041f3f73d3976f0cf04f2cd43e
Author: Scott Cantor <scott at restingparrotsoftware.com>
AuthorDate: Tue Apr 28 13:41:36 2026 -0400

    Remove extraneous state and add passive detection to error handler.
---
 .../sp/token-consumer/token-consumer-flow.xml      |  4 ---
 .../sp/profile/impl/PrepareAgentErrorResponse.java | 30 ++++++++++++++--------
 2 files changed, 19 insertions(+), 15 deletions(-)

diff --git a/sp-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/token-consumer/token-consumer-flow.xml b/sp-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/token-consumer/token-consumer-flow.xml
index 8bff417..bb6d54f 100644
--- a/sp-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/token-consumer/token-consumer-flow.xml
+++ b/sp-conf-impl/src/main/resources/META-INF/net/shibboleth/idp/flows/sp/token-consumer/token-consumer-flow.xml
@@ -24,10 +24,6 @@
         <transition on="proceed" to="EncodeAgentResponse" />
     </subflow-state>
     
-    <action-state id="NoPotentialFlow">
-        <evaluate expression="'NoPotentialFlow'" />
-    </action-state>
-    
     <!-- The file really exists in this directory, but it's referenced from extending flow-directories -->
     <bean-import resource="classpath:/META-INF/net/shibboleth/idp/flows/sp/token-consumer/token-consumer-beans.xml" />
 
diff --git a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/PrepareAgentErrorResponse.java b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/PrepareAgentErrorResponse.java
index e0478bc..3ba6a6e 100644
--- a/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/PrepareAgentErrorResponse.java
+++ b/sp-server-impl/src/main/java/net/shibboleth/sp/profile/impl/PrepareAgentErrorResponse.java
@@ -24,6 +24,7 @@ import org.opensaml.profile.context.EventContext;
 import org.opensaml.profile.context.ProfileRequestContext;
 import org.opensaml.profile.context.navigate.CurrentOrPreviousEventLookup;
 
+import net.shibboleth.idp.authn.AuthnEventIds;
 import net.shibboleth.shared.logic.Constraint;
 import net.shibboleth.sp.context.AgentRequestContext;
 import net.shibboleth.sp.context.StateDataContext;
@@ -95,22 +96,29 @@ public class PrepareAgentErrorResponse extends AbstractAgentRequestAction {
         final EventContext eventCtx = eventContextLookupStrategy.apply(profileRequestContext);
         final Object event = eventCtx != null ? eventCtx.getEvent() : null;
         if (event != null) {
-            final String eventString = event.toString();
-            output.addmember(SPConstants.EVENT).string(eventString);
+            output.addmember(SPConstants.EVENT).string(event.toString());
         } else {
             output.addmember(SPConstants.EVENT).string(EventIds.MESSAGE_PROC_ERROR);
         }
-        
+
+        // We use the StateData, if it exists, as a last-ditch source of the target parameter
+        // and to determine whether to override the event to NoPassive.
+        final StateDataContext stateDataContext = stateDataContextLookupStrategy.apply(profileRequestContext);
+        final StateData data = stateDataContext != null ? stateDataContext.getStateData() : null;
+
+        final Boolean passive = data != null ? data.getPassive() : null;
+        if (passive != null && passive) {
+            // Remap event and capture the original.
+            output.addmember(SPConstants.ORIGINAL_EVENT).string(output.getmember(SPConstants.EVENT).string());
+            output.getmember(SPConstants.EVENT).string(AuthnEventIds.NO_PASSIVE);
+        }
+
         // Populate target if necessary.
         if (output.getmember(SPConstants.TARGET).isnull()) {
-            final StateDataContext stateDataContext = stateDataContextLookupStrategy.apply(profileRequestContext);
-            if (stateDataContext != null) {
-                final StateData data = stateDataContext.getStateData();
-                if (data != null) {
-                    final byte[] target = data.getRawResource();
-                    if (target != null) {
-                        output.addmember(SPConstants.TARGET).unsafe_string(target);
-                    }
+            if (data != null) {
+                final byte[] target = data.getRawResource();
+                if (target != null) {
+                    output.addmember(SPConstants.TARGET).unsafe_string(target);
                 }
             }
         }

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


More information about the commits mailing list