[java-opensaml COMMIT] in /trunk/opensaml-saml-impl/src: main/java/org/opensaml/saml/common/profile/impl/CheckErrorHa...
noreply at shibboleth.net
noreply at shibboleth.net
Tue Apr 29 13:04:16 EDT 2014
Author: scantor
Date: Tue Apr 29 13:04:15 2014
New Revision: 3825
URL: http://svn.shibboleth.net/view/java-opensaml?rev=3825&view=rev
Log:
Convert error handling action to predicate to avoid overwriting event.
Added:
trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/logic/DefaultLocalErrorPredicate.java
- copied, changed from r3819, trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/impl/CheckErrorHandlingStrategy.java
Modified:
trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/impl/CheckErrorHandlingStrategy.java
trunk/opensaml-saml-impl/src/test/java/org/opensaml/saml/common/profile/impl/CheckErrorHandlingStrategyTest.java
Copied: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/logic/DefaultLocalErrorPredicate.java (from r3819, trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/impl/CheckErrorHandlingStrategy.java)
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/logic/DefaultLocalErrorPredicate.java?p2=trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/logic/DefaultLocalErrorPredicate.java&p1=trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/impl/CheckErrorHandlingStrategy.java&r1=3819&r2=3825&rev=3825&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/impl/CheckErrorHandlingStrategy.java (original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/logic/DefaultLocalErrorPredicate.java Tue Apr 29 13:04:15 2014
@@ -15,17 +15,15 @@
* limitations under the License.
*/
-package org.opensaml.saml.common.profile.impl;
+package org.opensaml.saml.common.profile.logic;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
-import org.opensaml.profile.action.AbstractConditionalProfileAction;
-import org.opensaml.profile.action.ActionSupport;
-import org.opensaml.profile.action.EventIds;
import org.opensaml.profile.context.PreviousEventContext;
import org.opensaml.profile.context.ProfileRequestContext;
import org.opensaml.profile.context.navigate.OutboundMessageContextLookup;
@@ -34,7 +32,6 @@
import org.opensaml.saml.common.messaging.context.SAMLPeerEntityContext;
import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
-import net.shibboleth.utilities.java.support.component.ComponentSupport;
import net.shibboleth.utilities.java.support.logic.Constraint;
import net.shibboleth.utilities.java.support.primitive.StringSupport;
@@ -44,23 +41,21 @@
import com.google.common.base.Function;
import com.google.common.base.Functions;
+import com.google.common.base.Predicate;
import com.google.common.collect.Sets;
/**
- * Action that decides whether to handle an error by returning a SAML response to a requester
+ * Predicate that decides whether to handle an error by returning a SAML response to a requester
* or fail locally.
*
* <p>This is principally determined based on whether or not the necessary message context children
* are present so that a response can be delivered, but is also tunable based on the error event
* being handled.</p>
- *
- * @event {@link EventIds#PROCEED_EVENT_ID}
- * @event {@link EventIds#TRAP_ERROR}
*/
-public class CheckErrorHandlingStrategy extends AbstractConditionalProfileAction {
+public class DefaultLocalErrorPredicate implements Predicate<ProfileRequestContext> {
/** Class logger. */
- @Nonnull private final Logger log = LoggerFactory.getLogger(CheckErrorHandlingStrategy.class);
+ @Nonnull private final Logger log = LoggerFactory.getLogger(DefaultLocalErrorPredicate.class);
/** Strategy function for access to {@link SAMLBindingContext} to check. */
@Nonnull private Function<ProfileRequestContext,SAMLBindingContext> bindingContextLookupStrategy;
@@ -74,12 +69,8 @@
/** Error events to handle locally, even if possible to do so with a response. */
@Nonnull @NonnullElements private Set<String> localEvents;
- /**
- * Constructor.
- *
- * Initializes {@link #messageMetadataContextLookupStrategy} to {@link ChildContextLookup}.
- */
- public CheckErrorHandlingStrategy() {
+ /** Constructor. */
+ public DefaultLocalErrorPredicate() {
// Default: outbound msg context -> SAMLBindingContext
bindingContextLookupStrategy = Functions.compose(
new ChildContextLookup<>(SAMLBindingContext.class), new OutboundMessageContextLookup());
@@ -102,8 +93,6 @@
*/
public void setBindingContextLookupStrategy(
@Nonnull final Function<ProfileRequestContext,SAMLBindingContext> strategy) {
- ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);
-
bindingContextLookupStrategy = Constraint.isNotNull(strategy,
[... 115 lines stripped ...]
More information about the commits
mailing list