[java-identity-provider] branch master updated: IDP-1153 - Enhance context-check interceptor to support multiple events.

Scott Cantor cantor.2 at osu.edu
Wed Mar 29 19:09:09 EDT 2017


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

scantor pushed a commit to branch master
in repository java-identity-provider.

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

The following commit(s) were added to refs/heads/master by this push:
       new  aa04076   IDP-1153 - Enhance context-check interceptor to support multiple events.
aa04076 is described below

commit aa0407628146c05933892e829f4505b3a3511980
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Mar 29 19:09:07 2017 -0400

    IDP-1153 - Enhance context-check interceptor to support multiple events.
    
    https://issues.shibboleth.net/jira/browse/IDP-1153
---
 .../intercept/context-check-intercept-config.xml   | 21 +++++++++++++++++++++
 .../system/flows/intercept/context-check-beans.xml |  2 --
 .../system/flows/intercept/context-check-flow.xml  | 22 ++++++++++++++++++++--
 3 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/idp-conf/src/main/resources/conf/intercept/context-check-intercept-config.xml b/idp-conf/src/main/resources/conf/intercept/context-check-intercept-config.xml
index 809f1d4..ae7976b 100644
--- a/idp-conf/src/main/resources/conf/intercept/context-check-intercept-config.xml
+++ b/idp-conf/src/main/resources/conf/intercept/context-check-intercept-config.xml
@@ -39,4 +39,25 @@
         </constructor-arg>
     </bean>
 
+    <!--
+    More general purpose approach using a Function that returns either "proceed" or a custom error Event.
+    This is a cleaner way of applying multiple conditions in different cases or triggering different events.
+    -->
+    <!--
+    <bean id="shibboleth.context-check.Function" parent="shibboleth.ContextFunctions.Scripted" factory-method="inlineScript"
+	        p:customObject-ref="shibboleth.context-check.Condition">
+        <constructor-arg>
+            <value>
+            <![CDATA[
+            var event = "proceed";
+            if (!custom.apply(input)) {
+                event = "ContextCheckDenied";
+            }
+            event;
+            ]]>
+            </value>
+        </constructor-arg>
+    </bean>
+    -->
+    
 </beans>
\ No newline at end of file
diff --git a/idp-conf/src/main/resources/system/flows/intercept/context-check-beans.xml b/idp-conf/src/main/resources/system/flows/intercept/context-check-beans.xml
index 06c83bf..97d4967 100644
--- a/idp-conf/src/main/resources/system/flows/intercept/context-check-beans.xml
+++ b/idp-conf/src/main/resources/system/flows/intercept/context-check-beans.xml
@@ -20,6 +20,4 @@
 
     <import resource="../../../conf/intercept/context-check-intercept-config.xml" />
 
-    <alias name="shibboleth.context-check.Condition" alias="ContextCheckPredicate"/>
-    
 </beans>
diff --git a/idp-conf/src/main/resources/system/flows/intercept/context-check-flow.xml b/idp-conf/src/main/resources/system/flows/intercept/context-check-flow.xml
index a98effc..0c9b840 100644
--- a/idp-conf/src/main/resources/system/flows/intercept/context-check-flow.xml
+++ b/idp-conf/src/main/resources/system/flows/intercept/context-check-flow.xml
@@ -3,8 +3,26 @@
       xsi:schemaLocation="http://www.springframework.org/schema/webflow http://www.springframework.org/schema/webflow/spring-webflow.xsd"
       parent="intercept.abstract">
 
-    <decision-state id="CheckContext">
-        <if test="ContextCheckPredicate.apply(opensamlProfileRequestContext)"
+    <!-- Rudimentary impediment to direct execution of subflow. -->
+    <input name="calledAsSubflow" type="boolean" required="true" />
+
+    <on-start>
+        <evaluate expression="flowRequestContext.getActiveFlow().getApplicationContext().containsBean('shibboleth.context-check.Function') ? flowRequestContext.getActiveFlow().getApplicationContext().getBean('shibboleth.context-check.Function') : null" result="flowScope.ContextCheckFunction" />
+    </on-start>
+    
+    <decision-state id="CheckForFunction">
+        <if test="ContextCheckFunction != null"
+            then="CallFunction" else="CheckCondition" />
+    </decision-state>
+
+    <action-state id="CallFunction">
+        <evaluate expression="ContextCheckFunction.apply(opensamlProfileRequestContext)" />
+        
+        <transition on="proceed" to="proceed" />
+    </action-state>
+    
+    <decision-state id="CheckCondition">
+        <if test="flowRequestContext.getActiveFlow().getApplicationContext().getBean('shibboleth.context-check.Condition').apply(opensamlProfileRequestContext)"
             then="proceed" else="ContextCheckDenied" />
     </decision-state>
     

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


More information about the commits mailing list