[java-idp-testbed COMMIT] in /trunk/src: main/java/idp/EncodeSAMLMessageFromBindingURI.java main/java/idp/SpringAware...

noreply at shibboleth.net noreply at shibboleth.net
Sat Feb 22 16:12:10 EST 2014


Author: scantor
Date: Sat Feb 22 16:12:09 2014
New Revision: 158

URL: http://svn.shibboleth.net/view/java-idp-testbed?rev=158&view=rev
Log:
- rework testbed Encode action to use new binding config
- move binding config to system tree
- remove other encoder lookup proposals

Modified:
    trunk/src/main/java/idp/EncodeSAMLMessageFromBindingURI.java
    trunk/src/main/java/idp/SpringAwareEncoderLookup.java
    trunk/src/test/java/idp/saml2/SAML2UnsolicitedFlowTest.java

Modified: trunk/src/main/java/idp/EncodeSAMLMessageFromBindingURI.java
URL: http://svn.shibboleth.net/view/java-idp-testbed/trunk/src/main/java/idp/EncodeSAMLMessageFromBindingURI.java?rev=158&r1=157&r2=158&view=diff
==============================================================================
--- trunk/src/main/java/idp/EncodeSAMLMessageFromBindingURI.java (original)
+++ trunk/src/main/java/idp/EncodeSAMLMessageFromBindingURI.java Sat Feb 22 16:12:09 2014
@@ -17,6 +17,8 @@
 
 package idp;
 
+import java.util.List;
+
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
@@ -24,11 +26,13 @@
 import net.shibboleth.ext.spring.webflow.Events;
 import net.shibboleth.idp.profile.AbstractProfileAction;
 import net.shibboleth.idp.profile.ActionSupport;
+import net.shibboleth.idp.saml.binding.BindingDescriptor;
+import net.shibboleth.utilities.java.support.annotation.constraint.NonnullElements;
 import net.shibboleth.utilities.java.support.component.ComponentInitializationException;
+import net.shibboleth.utilities.java.support.component.ComponentSupport;
 import net.shibboleth.utilities.java.support.logic.Constraint;
 
 import org.opensaml.messaging.context.MessageContext;
-import org.opensaml.messaging.decoder.MessageDecoder;
 import org.opensaml.messaging.encoder.MessageEncoder;
 import org.opensaml.messaging.encoder.MessageEncodingException;
 import org.opensaml.messaging.handler.MessageHandler;
@@ -39,7 +43,12 @@
 import org.opensaml.saml.common.messaging.context.SAMLBindingContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.beans.BeansException;
+import org.springframework.context.ApplicationContext;
 import org.springframework.webflow.execution.RequestContext;
+
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.ListMultimap;
 
 /** A profile stage that encodes an outbound response from the outbound {@link MessageContext}. 
  * 
@@ -59,24 +68,18 @@
     public static final String UNABLE_TO_ENCODE = "UnableToEncode";
 
     /** Class logger. */
-    private final Logger log = LoggerFactory.getLogger(EncodeSAMLMessageFromBindingURI.class);
-
-    private final SpringAwareEncoderLookup bindingLookup;
+    @Nonnull private final Logger log = LoggerFactory.getLogger(EncodeSAMLMessageFromBindingURI.class);
+    
+    @Nonnull @NonnullElements private ListMultimap<String,BindingDescriptor> bindingMap;
     
     /** An optional {@link MessageHandler} instance to be invoked after 
      * {@link MessageEncoder#prepareContext()} and prior to {@link MessageEncoder#encode()}.
      * May be null. */
-    private final MessageHandler messageHandler;
+    @Nullable private final MessageHandler messageHandler;
 
-    /**
-     * Constructor.
-     * 
-     * 
-     * @param messageEncoder the {@link MessageEncoder} used for the outbound response
-     */
-    public EncodeSAMLMessageFromBindingURI(@Nonnull final  SpringAwareEncoderLookup lookup) {
-        bindingLookup = Constraint.isNotNull(lookup, "Message encoder lookup can not be null");
-        messageHandler = null;
+    /** Constructor. */
+    public EncodeSAMLMessageFromBindingURI() {
+        this(null);
     }
     
     /**
@@ -87,15 +90,31 @@
      * {@link MessageEncoder#prepareContext()}, and prior to invoking {@link MessageEncoder#encode()}.
      * Its use is optional and primarily used for transport/binding-specific message handling, 
      * as opposed to more generalized message handling operations which would typically be invoked 
-     * earlier than this action.  For more details see {@link MessageEncoder}.
+     * earlier than this action. For more details see {@link MessageEncoder}.
      * </p>
      * 
-     * @param  the {@link MessageEncoder} used for the outbound response
      * @param handler the {@link MessageHandler} used for the outbound response
      */
-    public EncodeSAMLMessageFromBindingURI(@Nonnull final SpringAwareEncoderLookup lookup, @Nullable final MessageHandler handler) {
-        bindingLookup = Constraint.isNotNull(lookup, "Message encoder lookup can not be null");
+    public EncodeSAMLMessageFromBindingURI(@Nullable final MessageHandler handler) {
         messageHandler = handler;
+        bindingMap = ArrayListMultimap.create();
+    }
+    
+    /**
+     * Set the bindings to evaluate for use, in preference order.
+     * 
+     * @param bindings bindings to consider
+     */
+    public void setBindings(@Nonnull @NonnullElements final List<BindingDescriptor> bindings) {
+        ComponentSupport.ifInitializedThrowUnmodifiabledComponentException(this);

[... 200 lines stripped ...]


More information about the commits mailing list