Add in SAML 1 and 2 Artifact resolution profile handler configuration and add to...
authorlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 13 Sep 2007 14:14:37 +0000 (14:14 +0000)
committerlajoie <lajoie@ab3bd59b-922f-494d-bb5f-6f0a3c29deca>
Thu, 13 Sep 2007 14:14:37 +0000 (14:14 +0000)
git-svn-id: https://subversion.switch.ch/svn/shibboleth/java-idp/trunk@2385 ab3bd59b-922f-494d-bb5f-6f0a3c29deca

resources/classpath/schema/shibboleth-2.0-idp-profile-handler.xsd
resources/conf/handler.xml
src/edu/internet2/middleware/shibboleth/idp/config/profile/ProfileHandlerGroupBeanDefinitionParser.java
src/edu/internet2/middleware/shibboleth/idp/config/profile/ProfileHandlerNamespaceHandler.java
src/edu/internet2/middleware/shibboleth/idp/config/profile/saml1/SAML1ArtifactResolutionProfileHanderBeanDefinitionParser.java [new file with mode: 0644]
src/edu/internet2/middleware/shibboleth/idp/config/profile/saml1/SAML1AttributeQueryProfileHandlerBeanDefinitionParser.java
src/edu/internet2/middleware/shibboleth/idp/config/profile/saml2/SAML2ArtifactResolutionProfileHandlerBeanDefinitionParser.java [new file with mode: 0644]
src/edu/internet2/middleware/shibboleth/idp/profile/saml1/ArtifactResolution.java
src/edu/internet2/middleware/shibboleth/idp/profile/saml2/ArtifactResolution.java
test/data/conf1/handler.xml

index ef01ecf..9c3a409 100644 (file)
             <xsd:extension base="SAML2ProfileHandler" />
         </xsd:complexContent>
     </xsd:complexType>
+    
+    <xsd:complexType name="SAML2ArtifactResolution">
+        <xsd:annotation>
+            <xsd:documentation>Configuration type for SAML 2 artifact resolution profile handlers.</xsd:documentation>
+        </xsd:annotation>
+        <xsd:complexContent>
+            <xsd:extension base="SAML2ProfileHandler">
+                <xsd:attribute name="artifactMapRef" type="xsd:string" default="shibboleth.ArtifactMap">
+                    <xsd:annotation>
+                        <xsd:documentation>
+                            Reference to SAMLArtifactMap used by handler to resolve artifact strings into artifact objects.
+                        </xsd:documentation>
+                    </xsd:annotation>
+                </xsd:attribute>
+            </xsd:extension>
+        </xsd:complexContent>
+    </xsd:complexType>
 
     <xsd:complexType name="SAML2ProfileHandler" abstract="true">
         <xsd:annotation>
             <xsd:extension base="SAML1ProfileHandler" />
         </xsd:complexContent>
     </xsd:complexType>
+    
+    <xsd:complexType name="SAML1ArtifactResolution">
+        <xsd:annotation>
+            <xsd:documentation>Configuration type for SAML 1 artifact resolution profile handlers.</xsd:documentation>
+        </xsd:annotation>
+        <xsd:complexContent>
+            <xsd:extension base="SAML1ProfileHandler">
+                <xsd:attribute name="artifactMapRef" type="xsd:string" default="shibboleth.ArtifactMap">
+                    <xsd:annotation>
+                        <xsd:documentation>
+                            Reference to SAMLArtifactMap used by handler to resolve artifact strings into artifact objects.
+                        </xsd:documentation>
+                    </xsd:annotation>
+                </xsd:attribute>
+            </xsd:extension>
+        </xsd:complexContent>
+    </xsd:complexType>
 
     <xsd:complexType name="SAML1ProfileHandler" abstract="true">
         <xsd:annotation>
index b8a9f20..0aae92b 100644 (file)
         <RequestPath>/saml1/SOAP/AttributeQuery</RequestPath>
     </ProfileHandler>
     
+    <ProfileHandler xsi:type="SAML1ArtifactResolution" 
+                    inboundBinding="urn:oasis:names:tc:SAML:1.0:bindings:SOAP-binding"
+                    outboundBindingEnumeration="urn:oasis:names:tc:SAML:1.0:bindings:SOAP-binding">
+        <RequestPath>/saml1/SOAP/ArtifactResolution</RequestPath>
+    </ProfileHandler>
+    
     <ProfileHandler xsi:type="SAML2SSO" 
                     inboundBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
                     outboundBindingEnumeration="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST 
         <RequestPath>/saml2/SOAP/AttributeQuery</RequestPath>
     </ProfileHandler>
     
+    <ProfileHandler xsi:type="SAML2ArtifactResolution" 
+                    inboundBinding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
+                    outboundBindingEnumeration="urn:oasis:names:tc:SAML:2.0:bindings:SOAP">
+        <RequestPath>/saml2/SOAP/ArtifactResolution</RequestPath>
+    </ProfileHandler>
+    
     <LoginHandler xsi:type="RemoteUser">
         <AuthenticationMethod>urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified</AuthenticationMethod>
     </LoginHandler>
index 504b123..8ea8012 100644 (file)
@@ -36,11 +36,11 @@ import edu.internet2.middleware.shibboleth.common.config.SpringConfigurationUtil
  */
 public class ProfileHandlerGroupBeanDefinitionParser extends AbstractBeanDefinitionParser {
     
-    /** Class logger. */
-    private static Logger log = Logger.getLogger(ProfileHandlerGroupBeanDefinitionParser.class);
-
     /** Schema type name. */
     public static final QName SCHEMA_TYPE = new QName(ProfileHandlerNamespaceHandler.NAMESPACE, "ProfileHandlerGroup");
+    
+    /** Class logger. */
+    private static Logger log = Logger.getLogger(ProfileHandlerGroupBeanDefinitionParser.class);
 
     /** {@inheritDoc} */
     protected AbstractBeanDefinition parseInternal(Element config, ParserContext context) {
index 2847fa1..7249c82 100644 (file)
@@ -23,8 +23,10 @@ import edu.internet2.middleware.shibboleth.common.config.profile.JSPErrorHandler
 import edu.internet2.middleware.shibboleth.common.config.profile.VelocityErrorHandlerBeanDefinitionParser;
 import edu.internet2.middleware.shibboleth.idp.config.profile.authn.RemoteUserLoginHandlerBeanDefinitionParser;
 import edu.internet2.middleware.shibboleth.idp.config.profile.authn.UsernamePasswordLoginHandlerBeanDefinitionParser;
+import edu.internet2.middleware.shibboleth.idp.config.profile.saml1.SAML1ArtifactResolutionProfileHanderBeanDefinitionParser;
 import edu.internet2.middleware.shibboleth.idp.config.profile.saml1.SAML1AttributeQueryProfileHandlerBeanDefinitionParser;
 import edu.internet2.middleware.shibboleth.idp.config.profile.saml1.ShibbolethSSOProfileHandlerBeanDefinitionParser;
+import edu.internet2.middleware.shibboleth.idp.config.profile.saml2.SAML2ArtifactResolutionProfileHandlerBeanDefinitionParser;
 import edu.internet2.middleware.shibboleth.idp.config.profile.saml2.SAML2AttributeQueryProfileHandlerBeanDefinitionParser;
 import edu.internet2.middleware.shibboleth.idp.config.profile.saml2.SAML2SSOProfileHandlerBeanDefinitionParser;
 
@@ -43,6 +45,9 @@ public class ProfileHandlerNamespaceHandler extends BaseSpringNamespaceHandler {
 
         registerBeanDefinitionParser(ProfileHandlerGroupBeanDefinitionParser.SCHEMA_TYPE,
                 new ProfileHandlerGroupBeanDefinitionParser());
+        
+        registerBeanDefinitionParser(StatusHandlerBeanDefinitionParser.SCHEMA_TYPE,
+                new StatusHandlerBeanDefinitionParser());
 
         registerBeanDefinitionParser(new QName(NAMESPACE, JSPErrorHandlerBeanDefinitionParser.ELEMENT_NAME),
                 new JSPErrorHandlerBeanDefinitionParser());
@@ -55,15 +60,18 @@ public class ProfileHandlerNamespaceHandler extends BaseSpringNamespaceHandler {
 
         registerBeanDefinitionParser(SAML1AttributeQueryProfileHandlerBeanDefinitionParser.SCHEMA_TYPE,
                 new SAML1AttributeQueryProfileHandlerBeanDefinitionParser());
-
-        registerBeanDefinitionParser(StatusHandlerBeanDefinitionParser.SCHEMA_TYPE,
-                new StatusHandlerBeanDefinitionParser());
-
-        registerBeanDefinitionParser(SAML2AttributeQueryProfileHandlerBeanDefinitionParser.SCHEMA_TYPE,
-                new SAML2AttributeQueryProfileHandlerBeanDefinitionParser());
+        
+        registerBeanDefinitionParser(SAML1ArtifactResolutionProfileHanderBeanDefinitionParser.SCHEMA_TYPE,
+                new SAML1ArtifactResolutionProfileHanderBeanDefinitionParser());
 
         registerBeanDefinitionParser(SAML2SSOProfileHandlerBeanDefinitionParser.SCHEMA_TYPE,
                 new SAML2SSOProfileHandlerBeanDefinitionParser());
+        
+        registerBeanDefinitionParser(SAML2AttributeQueryProfileHandlerBeanDefinitionParser.SCHEMA_TYPE,
+                new SAML2AttributeQueryProfileHandlerBeanDefinitionParser());
+        
+        registerBeanDefinitionParser(SAML2ArtifactResolutionProfileHandlerBeanDefinitionParser.SCHEMA_TYPE,
+                new SAML2ArtifactResolutionProfileHandlerBeanDefinitionParser());
 
         registerBeanDefinitionParser(RemoteUserLoginHandlerBeanDefinitionParser.SCHEMA_TYPE,
                 new RemoteUserLoginHandlerBeanDefinitionParser());
diff --git a/src/edu/internet2/middleware/shibboleth/idp/config/profile/saml1/SAML1ArtifactResolutionProfileHanderBeanDefinitionParser.java b/src/edu/internet2/middleware/shibboleth/idp/config/profile/saml1/SAML1ArtifactResolutionProfileHanderBeanDefinitionParser.java
new file mode 100644 (file)
index 0000000..397bb57
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright [2007] [University Corporation for Advanced Internet Development, Inc.]
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package edu.internet2.middleware.shibboleth.idp.config.profile.saml1;
+
+import javax.xml.namespace.QName;
+
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.w3c.dom.Element;
+
+import edu.internet2.middleware.shibboleth.idp.config.profile.ProfileHandlerNamespaceHandler;
+import edu.internet2.middleware.shibboleth.idp.profile.saml1.ArtifactResolution;
+
+/**
+ * Spring bean definition parser for {@link ArtifactResolution}.
+ */
+public class SAML1ArtifactResolutionProfileHanderBeanDefinitionParser extends
+        AbstractSAML1ProfileHandlerBeanDefinitionParser {
+
+    /** Schema type. */
+    public static final QName SCHEMA_TYPE = new QName(ProfileHandlerNamespaceHandler.NAMESPACE,
+            "SAML1ArtifactResolution");
+
+    /** {@inheritDoc} */
+    protected Class getBeanClass(Element element) {
+        return ArtifactResolution.class;
+    }
+
+    /** {@inheritDoc} */
+    protected void doParse(Element config, BeanDefinitionBuilder builder) {
+        super.doParse(config, builder);
+
+        builder.addConstructorArgReference(config.getAttributeNS(null, "artifactMapRef"));
+    }
+}
diff --git a/src/edu/internet2/middleware/shibboleth/idp/config/profile/saml2/SAML2ArtifactResolutionProfileHandlerBeanDefinitionParser.java b/src/edu/internet2/middleware/shibboleth/idp/config/profile/saml2/SAML2ArtifactResolutionProfileHandlerBeanDefinitionParser.java
new file mode 100644 (file)
index 0000000..3f5daf2
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright [2007] [University Corporation for Advanced Internet Development, Inc.]
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package edu.internet2.middleware.shibboleth.idp.config.profile.saml2;
+
+import javax.xml.namespace.QName;
+
+import org.springframework.beans.factory.support.BeanDefinitionBuilder;
+import org.w3c.dom.Element;
+
+import edu.internet2.middleware.shibboleth.idp.config.profile.ProfileHandlerNamespaceHandler;
+import edu.internet2.middleware.shibboleth.idp.profile.saml2.ArtifactResolution;
+
+/**
+ * Spring bean definition parser for {@link ArtifactResolution}.
+ */
+public class SAML2ArtifactResolutionProfileHandlerBeanDefinitionParser extends
+        AbstractSAML2ProfileHandlerBeanDefinitionParser {
+
+    /** Schema type. */
+    public static final QName SCHEMA_TYPE = new QName(ProfileHandlerNamespaceHandler.NAMESPACE,
+            "SAML2ArtifactResolution");
+
+    /** {@inheritDoc} */
+    protected Class getBeanClass(Element element) {
+        return ArtifactResolution.class;
+    }
+
+    /** {@inheritDoc} */
+    protected void doParse(Element config, BeanDefinitionBuilder builder) {
+        super.doParse(config, builder);
+
+        builder.addConstructorArgReference(config.getAttributeNS(null, "artifactMapRef"));
+    }
+}
index 8fdf1d1..0482549 100644 (file)
@@ -51,7 +51,7 @@ import edu.internet2.middleware.shibboleth.common.relyingparty.RelyingPartyConfi
 import edu.internet2.middleware.shibboleth.common.relyingparty.provider.saml1.ArtifactResolutionConfiguration;
 
 /**
- * SAML 2.0 Artifact resolution profile handler.
+ * SAML 1 Artifact resolution profile handler.
  */
 public class ArtifactResolution extends AbstractSAML1ProfileHandler {
 
@@ -64,9 +64,16 @@ public class ArtifactResolution extends AbstractSAML1ProfileHandler {
     /** Map artifacts to SAML messages. */
     private SAMLArtifactMap artifactMap;
 
-    /** Constructor. */
-    public ArtifactResolution() {
+    /**
+     * Constructor.
+     * 
+     * @param map ArtifactMap used to lookup artifacts to be resolved.
+     */
+    public ArtifactResolution(SAMLArtifactMap map) {
         super();
+
+        artifactMap = map;
+
         responseBuilder = (SAMLObjectBuilder<Response>) getBuilderFactory().getBuilder(Response.DEFAULT_ELEMENT_NAME);
     }
 
@@ -128,11 +135,11 @@ public class ArtifactResolution extends AbstractSAML1ProfileHandler {
 
         ArtifactResolutionRequestContext requestContext = new ArtifactResolutionRequestContext();
         requestContext.setMetadataProvider(metadataProvider);
-        
+
         requestContext.setInboundMessageTransport(inTransport);
         requestContext.setInboundSAMLProtocol(SAMLConstants.SAML11P_NS);
         requestContext.setPeerEntityRole(SPSSODescriptor.DEFAULT_ELEMENT_NAME);
-        
+
         requestContext.setOutboundMessageTransport(outTransport);
         requestContext.setOutboundSAMLProtocol(SAMLConstants.SAML11P_NS);
 
@@ -157,7 +164,7 @@ public class ArtifactResolution extends AbstractSAML1ProfileHandler {
             // Set as much information as can be retrieved from the decoded message
             try {
                 String relyingPartyId = requestContext.getInboundMessageIssuer();
-                
+
                 RelyingPartyConfiguration rpConfig = getRelyingPartyConfiguration(relyingPartyId);
                 requestContext.setRelyingPartyConfiguration(rpConfig);
 
index 15b430c..8e9939e 100644 (file)
@@ -61,9 +61,16 @@ public class ArtifactResolution extends AbstractSAML2ProfileHandler {
     /** Artifact response object builder. */
     private SAMLObjectBuilder<ArtifactResponse> responseBuilder;
 
-    /** Constructor. */
-    public ArtifactResolution() {
+    /**
+     * Constructor.
+     * 
+     * @param map ArtifactMap used to lookup artifacts to be resolved.
+     */
+    public ArtifactResolution(SAMLArtifactMap map) {
         super();
+        
+        artifactMap = map;
+        
         responseBuilder = (SAMLObjectBuilder<ArtifactResponse>) getBuilderFactory().getBuilder(
                 ArtifactResponse.DEFAULT_ELEMENT_NAME);
     }
@@ -292,10 +299,10 @@ public class ArtifactResolution extends AbstractSAML2ProfileHandler {
         /**
          * Sets the artifact to be resolved.
          * 
-         * @param artifact artifact to be resolved
+         * @param saml2Artifact artifact to be resolved
          */
-        public void setArtifact(AbstractSAML2Artifact artifact) {
-            this.artifact = artifact;
+        public void setArtifact(AbstractSAML2Artifact saml2Artifact) {
+            this.artifact = saml2Artifact;
         }
 
         /**
index 5345e50..b4c722d 100644 (file)
         <RequestPath>/saml1/SOAP/AttributeQuery</RequestPath>
     </ProfileHandler>
     
+    <ProfileHandler xsi:type="SAML1ArtifactResolution" 
+                    inboundBinding="urn:oasis:names:tc:SAML:1.0:bindings:SOAP-binding"
+                    outboundBindingEnumeration="urn:oasis:names:tc:SAML:1.0:bindings:SOAP-binding">
+        <RequestPath>/saml1/SOAP/ArtifactResolution</RequestPath>
+    </ProfileHandler>
+    
     <ProfileHandler xsi:type="SAML2SSO" 
                     inboundBinding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST"
                     outboundBindingEnumeration="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST 
         <RequestPath>/saml2/SOAP/AttributeQuery</RequestPath>
     </ProfileHandler>
     
+    <ProfileHandler xsi:type="SAML2ArtifactResolution" 
+                    inboundBinding="urn:oasis:names:tc:SAML:2.0:bindings:SOAP"
+                    outboundBindingEnumeration="urn:oasis:names:tc:SAML:2.0:bindings:SOAP">
+        <RequestPath>/saml2/SOAP/ArtifactResolution</RequestPath>
+    </ProfileHandler>
+    
     <LoginHandler xsi:type="RemoteUser">
         <AuthenticationMethod>urn:oasis:names:tc:SAML:2.0:ac:classes:unspecified</AuthenticationMethod>
     </LoginHandler>