[java-identity-provider COMMIT] in /trunk: idp-profile-api/src/main/java/net/shibboleth/idp/profile/EventIds.java idp...

noreply at shibboleth.net noreply at shibboleth.net
Fri Jul 20 10:42:22 EDT 2012


Author: lajoie
Date: Fri Jul 20 10:42:22 2012
New Revision: 4212

URL: http://svn.shibboleth.net/view/java-identity-provider?rev=4212&view=rev
Log:
Add profile stage that can schema validate a message

Modified:
    trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/EventIds.java
    trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/SchemaValidateXmlMessage.java
    trunk/idp-saml-impl/src/main/java/net/shibboleth/idp/saml/impl/profile/AddSamlMetadataToMessageContext.java

Modified: trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/EventIds.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/EventIds.java?rev=4212&r1=4211&r2=4212&view=diff
==============================================================================
--- trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/EventIds.java (original)
+++ trunk/idp-profile-api/src/main/java/net/shibboleth/idp/profile/EventIds.java Fri Jul 20 10:42:22 2012
@@ -23,8 +23,11 @@
     /** Incoming request did not contains a {@link ProfileRequestContext}. */
     public static final String NO_PROFILE_CTX = "NoProfileCtx";
 
-    /** ID of the event returned if an expected {@link org.opensaml.messaging.context.MessageContext} is missing. */
-    public static final String NO_MSG_CTX = "NoMessageContext";
+    /**
+     * ID of the event returned if an expected {@link org.opensaml.messaging.context.MessageContext} is missing or
+     * invalid in some way.
+     */
+    public static final String INVALID_MSG_CTX = "InvalidMessageContext";
 
     /**
      * ID of the event returned if a {@link org.opensaml.messaging.context.MessageContext} does not contain a necessary

Modified: trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/SchemaValidateXmlMessage.java
URL: http://svn.shibboleth.net/view/java-identity-provider/trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/SchemaValidateXmlMessage.java?rev=4212&r1=4211&r2=4212&view=diff
==============================================================================
--- trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/SchemaValidateXmlMessage.java (original)
+++ trunk/idp-profile-impl/src/main/java/net/shibboleth/idp/profile/impl/SchemaValidateXmlMessage.java Fri Jul 20 10:42:22 2012
@@ -26,27 +26,31 @@
 import javax.xml.validation.Schema;
 import javax.xml.validation.Validator;
 
+import net.shibboleth.ext.spring.webflow.Event;
+import net.shibboleth.ext.spring.webflow.Events;
 import net.shibboleth.idp.profile.AbstractProfileAction;
 import net.shibboleth.idp.profile.ActionSupport;
-import net.shibboleth.idp.profile.InvalidInboundMessageException;
+import net.shibboleth.idp.profile.EventIds;
 import net.shibboleth.idp.profile.ProfileException;
 import net.shibboleth.idp.profile.ProfileRequestContext;
 import net.shibboleth.utilities.java.support.logic.Constraint;
 
 import org.opensaml.core.xml.XMLObject;
-import org.opensaml.core.xml.config.XMLObjectProviderRegistrySupport;
-import org.opensaml.core.xml.io.Marshaller;
-import org.opensaml.core.xml.io.MarshallingException;
+import org.opensaml.messaging.context.MessageContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.springframework.webflow.execution.Event;
 import org.springframework.webflow.execution.RequestContext;
-import org.w3c.dom.Document;
 import org.w3c.dom.Element;
 import org.xml.sax.SAXException;
 
 /** An action that schema validates inbound XML messages. */
+ at Events({@Event(id = EventIds.PROCEED_EVENT_ID),
+        @Event(id = EventIds.INVALID_MSG_CTX, description = "No inbound message context or message"),
+        @Event(id = SchemaValidateXmlMessage.SCHEMA_INVALID, description = "Inbound message was schema invalid")})
 public class SchemaValidateXmlMessage extends AbstractProfileAction<XMLObject, Object> {
+
+    /** ID of the event returned if the incoming request is schema invalid. */
+    public static final String SCHEMA_INVALID = "SchemaInvalid";
 
     /** Class logger. */
     private Logger log = LoggerFactory.getLogger(SchemaValidateXmlMessage.class);
@@ -73,80 +77,43 @@
     }
 
     /** {@inheritDoc} */
-    protected Event doExecute(HttpServletRequest httpRequest, HttpServletResponse httpResponse,
-            RequestContext springRequestContext, ProfileRequestContext<XMLObject, Object> profileRequestContext)
-            throws ProfileException {
+    protected org.springframework.webflow.execution.Event doExecute(HttpServletRequest httpRequest,
+            HttpServletResponse httpResponse, RequestContext springRequestContext,
+            ProfileRequestContext<XMLObject, Object> profileRequestContext) throws ProfileException {
 
         log.debug("Action {}: Attempting to schema validate incoming message", getId());
 
-        final XMLObject request = profileRequestContext.getInboundMessageContext().getMessage();
+        final MessageContext<XMLObject> msgCtx = profileRequestContext.getInboundMessageContext();
+        if (msgCtx == null) {

[... 112 lines stripped ...]


More information about the commits mailing list