Clean up protocol abstract type classes (need proper casts in binding plugins).
[shibboleth/cpp-opensaml.git] / saml / saml2 / core / impl / Protocols20SchemaValidators.cpp
index 916035e..d25955f 100644 (file)
@@ -39,6 +39,8 @@ namespace opensaml {
         XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,RequesterID);
         XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,SessionIndex);
         XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,StatusMessage);
+        
+        XMLOBJECTVALIDATOR_SIMPLE(SAML_DLLLOCAL,RespondTo);
 
         //TODO wildcard NS ##other - spec says must be a "non-SAML defined" namespace,
         // not just other than the target namespace
@@ -55,24 +57,24 @@ namespace opensaml {
             }
         };
 
-        BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,Request);
-            XMLOBJECTVALIDATOR_REQUIRE(Request,ID);
-            XMLOBJECTVALIDATOR_REQUIRE(Request,Version);
-            XMLOBJECTVALIDATOR_REQUIRE(Request,IssueInstant);
+        BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,RequestAbstractType);
+            XMLOBJECTVALIDATOR_REQUIRE(RequestAbstractType,ID);
+            XMLOBJECTVALIDATOR_REQUIRE(RequestAbstractType,Version);
+            XMLOBJECTVALIDATOR_REQUIRE(RequestAbstractType,IssueInstant);
             if (!XMLString::equals(SAMLConstants::SAML20_VERSION, ptr->getVersion()))
                 throw ValidationException("Request has wrong SAML Version.");
         END_XMLOBJECTVALIDATOR;
 
-        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,SubjectQuery,Request);
-            RequestSchemaValidator::validate(xmlObject);
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,SubjectQuery,RequestAbstractType);
+            RequestAbstractTypeSchemaValidator::validate(xmlObject);
             XMLOBJECTVALIDATOR_REQUIRE(SubjectQuery,Subject);
         END_XMLOBJECTVALIDATOR;
 
-        BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,StatusResponse);
-            XMLOBJECTVALIDATOR_REQUIRE(StatusResponse,ID);
-            XMLOBJECTVALIDATOR_REQUIRE(StatusResponse,Version);
-            XMLOBJECTVALIDATOR_REQUIRE(StatusResponse,IssueInstant);
-            XMLOBJECTVALIDATOR_REQUIRE(StatusResponse,Status);
+        BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,StatusResponseType);
+            XMLOBJECTVALIDATOR_REQUIRE(StatusResponseType,ID);
+            XMLOBJECTVALIDATOR_REQUIRE(StatusResponseType,Version);
+            XMLOBJECTVALIDATOR_REQUIRE(StatusResponseType,IssueInstant);
+            XMLOBJECTVALIDATOR_REQUIRE(StatusResponseType,Status);
             if (!XMLString::equals(SAMLConstants::SAML20_VERSION, ptr->getVersion()))
                 throw ValidationException("StatusResponse has wrong SAML Version.");
         END_XMLOBJECTVALIDATOR;
@@ -114,8 +116,8 @@ namespace opensaml {
             XMLOBJECTVALIDATOR_REQUIRE(Status,StatusCode);
         END_XMLOBJECTVALIDATOR;
 
-        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,AssertionIDRequest,Request);
-            RequestSchemaValidator::validate(xmlObject);
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,AssertionIDRequest,RequestAbstractType);
+            RequestAbstractTypeSchemaValidator::validate(xmlObject);
             XMLOBJECTVALIDATOR_NONEMPTY(AssertionIDRequest,AssertionIDRef);
         END_XMLOBJECTVALIDATOR;
 
@@ -161,57 +163,57 @@ namespace opensaml {
                 throw xmltooling::ValidationException("ProxyCount attribute on Scoping element must be non-negative"); 
         END_XMLOBJECTVALIDATOR;
 
-        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,AuthnRequest,Request);
-            RequestSchemaValidator::validate(xmlObject);
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,AuthnRequest,RequestAbstractType);
+            RequestAbstractTypeSchemaValidator::validate(xmlObject);
             if (ptr->getAssertionConsumerServiceIndex().first 
                     && (ptr->getAssertionConsumerServiceURL()!=NULL || ptr->getProtocolBinding()!=NULL))
                 throw xmltooling::ValidationException("On AuthnRequest AssertionConsumerServiceIndex is mutually exclusive with both AssertionConsumerServiceURL and ProtocolBinding");
         END_XMLOBJECTVALIDATOR;
 
-        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,Response,StatusResponse);
-            StatusResponseSchemaValidator::validate(xmlObject);
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,Response,StatusResponseType);
+            StatusResponseTypeSchemaValidator::validate(xmlObject);
         END_XMLOBJECTVALIDATOR;
 
-        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,ArtifactResolve,Request);
-            RequestSchemaValidator::validate(xmlObject);
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,ArtifactResolve,RequestAbstractType);
+            RequestAbstractTypeSchemaValidator::validate(xmlObject);
             XMLOBJECTVALIDATOR_REQUIRE(ArtifactResolve,Artifact);
         END_XMLOBJECTVALIDATOR;
 
-        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,ArtifactResponse,StatusResponse);
-            StatusResponseSchemaValidator::validate(xmlObject);
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,ArtifactResponse,StatusResponseType);
+            StatusResponseTypeSchemaValidator::validate(xmlObject);
         END_XMLOBJECTVALIDATOR;
 
         BEGIN_XMLOBJECTVALIDATOR(SAML_DLLLOCAL,NewEncryptedID);
             XMLOBJECTVALIDATOR_REQUIRE(NewEncryptedID,EncryptedData);
         END_XMLOBJECTVALIDATOR;
 
-        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,ManageNameIDRequest,Request);
-            RequestSchemaValidator::validate(xmlObject);
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,ManageNameIDRequest,RequestAbstractType);
+            RequestAbstractTypeSchemaValidator::validate(xmlObject);
             XMLOBJECTVALIDATOR_ONLYONEOF(ManageNameIDRequest,NameID,EncryptedID);
             XMLOBJECTVALIDATOR_ONLYONEOF3(ManageNameIDRequest,NewID,NewEncryptedID,Terminate);
         END_XMLOBJECTVALIDATOR;
 
-        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,ManageNameIDResponse,StatusResponse);
-            StatusResponseSchemaValidator::validate(xmlObject);
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,ManageNameIDResponse,StatusResponseType);
+            StatusResponseTypeSchemaValidator::validate(xmlObject);
         END_XMLOBJECTVALIDATOR;
 
-        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,LogoutRequest,Request);
-            RequestSchemaValidator::validate(xmlObject);
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,LogoutRequest,RequestAbstractType);
+            RequestAbstractTypeSchemaValidator::validate(xmlObject);
             XMLOBJECTVALIDATOR_ONLYONEOF3(LogoutRequest,BaseID,NameID,EncryptedID);
         END_XMLOBJECTVALIDATOR;
 
-        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,LogoutResponse,StatusResponse);
-            StatusResponseSchemaValidator::validate(xmlObject);
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,LogoutResponse,StatusResponseType);
+            StatusResponseTypeSchemaValidator::validate(xmlObject);
         END_XMLOBJECTVALIDATOR;
 
-        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,NameIDMappingRequest,Request);
-            RequestSchemaValidator::validate(xmlObject);
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,NameIDMappingRequest,RequestAbstractType);
+            RequestAbstractTypeSchemaValidator::validate(xmlObject);
             XMLOBJECTVALIDATOR_ONLYONEOF3(NameIDMappingRequest,BaseID,NameID,EncryptedID);
             XMLOBJECTVALIDATOR_REQUIRE(NameIDMappingRequest,NameIDPolicy);
         END_XMLOBJECTVALIDATOR;
 
-        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,NameIDMappingResponse,StatusResponse);
-            StatusResponseSchemaValidator::validate(xmlObject);
+        BEGIN_XMLOBJECTVALIDATOR_SUB(SAML_DLLLOCAL,NameIDMappingResponse,StatusResponseType);
+            StatusResponseTypeSchemaValidator::validate(xmlObject);
             XMLOBJECTVALIDATOR_ONLYONEOF(NameIDMappingResponse,NameID,EncryptedID);
         END_XMLOBJECTVALIDATOR;
 
@@ -292,7 +294,10 @@ void opensaml::saml2p::registerProtocolClasses() {
     REGISTER_TYPE(Scoping);
     REGISTER_TYPE(Status);
     REGISTER_TYPE(StatusCode);
-    REGISTER_TYPE(StatusResponse);
     REGISTER_TYPE_NOVAL(StatusDetail);
     REGISTER_TYPE_NOVAL(Terminate);
+
+    q=QName(SAMLConstants::SAML20P_THIRDPARTY_EXT_NS,RespondTo::LOCAL_NAME);
+    XMLObjectBuilder::registerBuilder(q,new RespondToBuilder());
+    ProtocolSchemaValidators.registerValidator(q,new RespondToSchemaValidator());
 }