[java-opensaml COMMIT] in /trunk: opensaml-profile-api/src/main/java/org/opensaml/profile/context/navigate/CurrentOrP...
noreply at shibboleth.net
noreply at shibboleth.net
Mon Jun 2 10:21:44 EDT 2014
Author: scantor
Date: Mon Jun 2 10:21:43 2014
New Revision: 3905
URL: http://svn.shibboleth.net/view/java-opensaml?rev=3905&view=rev
Log:
Sync up event handling in status actions to rest of code.
Added:
trunk/opensaml-profile-api/src/main/java/org/opensaml/profile/context/navigate/CurrentOrPreviousEventLookupFunction.java (with props)
Modified:
trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/logic/DefaultLocalErrorPredicate.java
trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/profile/impl/AddStatusToResponse.java
trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml2/profile/impl/AddStatusToResponse.java
Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/logic/DefaultLocalErrorPredicate.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/logic/DefaultLocalErrorPredicate.java?rev=3905&r1=3904&r2=3905&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/logic/DefaultLocalErrorPredicate.java (original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/common/profile/logic/DefaultLocalErrorPredicate.java Mon Jun 2 10:21:43 2014
@@ -25,8 +25,8 @@
import javax.annotation.Nullable;
import org.opensaml.profile.context.EventContext;
-import org.opensaml.profile.context.PreviousEventContext;
import org.opensaml.profile.context.ProfileRequestContext;
+import org.opensaml.profile.context.navigate.CurrentOrPreviousEventLookupFunction;
import org.opensaml.profile.context.navigate.OutboundMessageContextLookup;
import org.opensaml.saml.common.messaging.context.SAMLBindingContext;
import org.opensaml.saml.common.messaging.context.SAMLEndpointContext;
@@ -174,24 +174,5 @@
}
}
// Checkstyle: CyclomaticComplexity ON
-
- /** Access either current or previous event from context tree. */
- private class CurrentOrPreviousEventLookupFunction implements Function<ProfileRequestContext,EventContext> {
- /** {@inheritDoc} */
- @Override
- @Nullable public EventContext apply(@Nullable final ProfileRequestContext input) {
- if (input != null) {
- final EventContext eventCtx = input.getSubcontext(EventContext.class);
- if (eventCtx != null) {
- return eventCtx;
- } else {
- return input.getSubcontext(PreviousEventContext.class);
- }
- } else {
- return null;
- }
- }
-
- }
}
Modified: trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/profile/impl/AddStatusToResponse.java
URL: http://svn.shibboleth.net/view/java-opensaml/trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/profile/impl/AddStatusToResponse.java?rev=3905&r1=3904&r2=3905&view=diff
==============================================================================
--- trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/profile/impl/AddStatusToResponse.java (original)
+++ trunk/opensaml-saml-impl/src/main/java/org/opensaml/saml/saml1/profile/impl/AddStatusToResponse.java Mon Jun 2 10:21:43 2014
@@ -29,8 +29,9 @@
import org.opensaml.profile.action.AbstractProfileAction;
import org.opensaml.profile.action.ActionSupport;
import org.opensaml.profile.action.EventIds;
-import org.opensaml.profile.context.PreviousEventContext;
+import org.opensaml.profile.context.EventContext;
import org.opensaml.profile.context.ProfileRequestContext;
+import org.opensaml.profile.context.navigate.CurrentOrPreviousEventLookupFunction;
import org.opensaml.profile.context.navigate.OutboundMessageContextLookup;
import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
@@ -297,6 +298,9 @@
/** Code mappings. */
@Nonnull @NonnullElements private Map<String,List<QName>> codeMappings;
+ /** Strategy function for access to {@link EventContext} to check. */
+ @Nonnull private Function<ProfileRequestContext,EventContext> eventContextLookupStrategy;
+
/**
* Constructor.
*
@@ -313,16 +317,26 @@
Lists.newArrayList(Collections2.filter(entry.getValue(), Predicates.notNull())));
}
}
+
+ eventContextLookupStrategy = new CurrentOrPreviousEventLookupFunction();
+ }
+
+ /**
+ * Set lookup strategy for {@link EventContext} to check.
+ *
+ * @param strategy lookup strategy
+ */
+ public void setEventContextLookupStrategy(
+ @Nonnull final Function<ProfileRequestContext,EventContext> strategy) {
+ eventContextLookupStrategy = Constraint.isNotNull(strategy, "EventContext lookup strategy cannot be null");
}
/** {@inheritDoc} */
@Override
[... 73 lines stripped ...]
More information about the commits
mailing list