[java-identity-provider COMMIT] in /trunk/idp-authn-impl/src: main/java/net/shibboleth/idp/authn/impl/FilterAvailable...

noreply at shibboleth.net noreply at shibboleth.net
Tue Jul 23 18:49:33 EDT 2013


Author: scantor
Date: Tue Jul 23 18:49:33 2013
New Revision: 4613

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4613&view=rev
Log:
Re-fit the passive filtering action, add unit test.

Added:
    trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/FilterPotentialFlowsByPassivity.java
      - copied, changed from r4609, trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/FilterAvailableWorkflowsByPassivity.java
    trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/FilterPotentialFlowsByPassivityTest.java   (with props)
Modified:
    trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/FilterAvailableWorkflowsByPassivity.java
    trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/InitializeAuthenticationContext.java
    trunk/idp-authn-impl/src/test/java/net/shibboleth/idp/authn/impl/InitializeAuthenticationContextTest.java

Copied: trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/FilterPotentialFlowsByPassivity.java (from r4609, trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/FilterAvailableWorkflowsByPassivity.java)
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/FilterPotentialFlowsByPassivity.java?p2=trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/FilterPotentialFlowsByPassivity.java&p1=trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/FilterAvailableWorkflowsByPassivity.java&r1=4609&r2=4613&rev=4613&view=diff
==============================================================================
--- trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/FilterAvailableWorkflowsByPassivity.java (original)
+++ trunk/idp-authn-impl/src/main/java/net/shibboleth/idp/authn/impl/FilterPotentialFlowsByPassivity.java Tue Jul 23 18:49:33 2013
@@ -23,72 +23,64 @@
 
 import javax.annotation.Nonnull;
 
-import net.shibboleth.ext.spring.webflow.Event;
-import net.shibboleth.ext.spring.webflow.Events;
 import net.shibboleth.idp.authn.AbstractAuthenticationAction;
 import net.shibboleth.idp.authn.AuthenticationException;
 import net.shibboleth.idp.authn.AuthenticationFlowDescriptor;
-import net.shibboleth.idp.authn.AuthnEventIds;
 import net.shibboleth.idp.authn.context.AuthenticationContext;
-import net.shibboleth.idp.profile.ActionSupport;
 
-import org.opensaml.profile.action.EventIds;
 import org.opensaml.profile.context.ProfileRequestContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.webflow.execution.RequestContext;
 
 /**
- * An authentication action that filters out potential authentication workflows if the current request is a passive
- * request and the workflow does not support passive authentication.
+ * An authentication action that filters out potential authentication flows if the request requires
+ * passive behavior and the flows don't support passive authentication.
+ * 
+ * @event {@link org.opensaml.profile.action.EventIds#PROCEED_EVENT_ID}
+ * @pre <pre>ProfileRequestContext.getSubcontext(AuthenticationContext.class, false) != null</pre>
+ * @post <pre>AuthenticationContext.getPotentialFlows()</pre> is modified as above.
  */
- at Events({@Event(id = EventIds.PROCEED_EVENT_ID),
-        @Event(id = AuthnEventIds.NO_POTENTIAL_WORKFLOW, description = "No potential workflows left after filtering")})
-public class FilterAvailableWorkflowsByPassivity extends AbstractAuthenticationAction {
+public class FilterPotentialFlowsByPassivity extends AbstractAuthenticationAction {
 
     /** Class logger. */
-    private final Logger log = LoggerFactory.getLogger(FilterAvailableWorkflowsByPassivity.class);
+    private final Logger log = LoggerFactory.getLogger(FilterPotentialFlowsByPassivity.class);
 
     /** {@inheritDoc} */
-    protected org.springframework.webflow.execution.Event doExecute(@Nonnull final RequestContext springRequestContext,
-            @Nonnull final ProfileRequestContext profileRequestContext,
+    protected boolean doPreExecute(@Nonnull final ProfileRequestContext profileRequestContext,
+            @Nonnull final AuthenticationContext authenticationContext) throws AuthenticationException {
+        
+        if (!authenticationContext.isPassive()) {
+            log.debug("{} authentication request does not have passive requirement, nothing to do", getLogPrefix());
+            return false;
+        }
+        
+        return true;
+    }
+    
+    /** {@inheritDoc} */
+    protected void doExecute(@Nonnull final ProfileRequestContext profileRequestContext,
             @Nonnull final AuthenticationContext authenticationContext) throws AuthenticationException {
 
-        if (!profileRequestContext.isPassiveProfile()) {
-            log.debug("Action {}: current profile request is not a passive request, nothing to do", getId());
-            return ActionSupport.buildProceedEvent(this);
-        }
-
-        final Map<String, AuthenticationFlowDescriptor> potentialWorkflows =
-                authenticationContext.getPotentialFlows();

[... 178 lines stripped ...]


More information about the commits mailing list