Add missing exception declaration.
authorcantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Thu, 9 Aug 2007 19:39:38 +0000 (19:39 +0000)
committercantor <cantor@cb58f699-b61c-0410-a6fe-9272a202ed29>
Thu, 9 Aug 2007 19:39:38 +0000 (19:39 +0000)
Propagate SAML 2 errors from artifact resolver.

git-svn-id: https://svn.middleware.georgetown.edu/cpp-sp/trunk@2404 cb58f699-b61c-0410-a6fe-9272a202ed29

shibsp/SPConfig.cpp
shibsp/binding/impl/ArtifactResolver.cpp
shibsp/exceptions.h

index 26b86fe..8116b91 100644 (file)
@@ -74,11 +74,12 @@ DECL_XMLTOOLING_EXCEPTION_FACTORY(ConfigurationException,shibsp);
 DECL_XMLTOOLING_EXCEPTION_FACTORY(ListenerException,shibsp);
 
 #ifdef SHIBSP_LITE
-DECL_XMLTOOLING_EXCEPTION_FACTORY(MetadataException,opensaml::saml2md);
+DECL_XMLTOOLING_EXCEPTION_FACTORY(BindingException,opensaml);
 DECL_XMLTOOLING_EXCEPTION_FACTORY(SecurityPolicyException,opensaml);
 DECL_XMLTOOLING_EXCEPTION_FACTORY(ProfileException,opensaml);
 DECL_XMLTOOLING_EXCEPTION_FACTORY(FatalProfileException,opensaml);
 DECL_XMLTOOLING_EXCEPTION_FACTORY(RetryableProfileException,opensaml);
+DECL_XMLTOOLING_EXCEPTION_FACTORY(MetadataException,opensaml::saml2md);
 #endif
 
 namespace shibsp {
@@ -143,6 +144,7 @@ bool SPInternalConfig::init(const char* catalog_path)
     REGISTER_XMLTOOLING_EXCEPTION_FACTORY(ListenerException,shibsp);
 
 #ifdef SHIBSP_LITE
+    REGISTER_XMLTOOLING_EXCEPTION_FACTORY(BindingException,opensaml);
     REGISTER_XMLTOOLING_EXCEPTION_FACTORY(SecurityPolicyException,opensaml);
     REGISTER_XMLTOOLING_EXCEPTION_FACTORY(ProfileException,opensaml);
     REGISTER_XMLTOOLING_EXCEPTION_FACTORY(FatalProfileException,opensaml);
index 0f35ef5..33863d4 100644 (file)
@@ -145,8 +145,9 @@ ArtifactResponse* ArtifactResolver::resolve(
         throw BindingException("Unable to resolve artifact(s) into a SAML response.");
     else if (!response->getStatus() || !response->getStatus()->getStatusCode() ||
            !XMLString::equals(response->getStatus()->getStatusCode()->getValue(), saml2p::StatusCode::SUCCESS)) {
-        delete response;
-        throw BindingException("Identity provider returned a SAML error in response to artifact.");
+        auto_ptr<ArtifactResponse> wrapper(response);
+        BindingException ex("Identity provider returned a SAML error in response to artifact.");
+        annotateException(&ex, &ssoDescriptor, response->getStatus());  // rethrow
     }
     return response;
 }
index 5bd65f4..a12e720 100644 (file)
@@ -43,6 +43,7 @@ namespace shibsp {
 
 #ifdef SHIBSP_LITE
 namespace opensaml {
+    DECL_XMLTOOLING_EXCEPTION(BindingException,SHIBSP_EXCEPTIONAPI(SHIBSP_API),opensaml,xmltooling::XMLToolingException,Exceptions in SAML binding processing);
     DECL_XMLTOOLING_EXCEPTION(SecurityPolicyException,SHIBSP_EXCEPTIONAPI(SHIBSP_API),opensaml,xmltooling::XMLToolingException,Exceptions in security policy processing);
     DECL_XMLTOOLING_EXCEPTION(ProfileException,SHIBSP_EXCEPTIONAPI(SHIBSP_API),opensaml,xmltooling::ValidationException,Exceptions in SAML profile processing);
     DECL_XMLTOOLING_EXCEPTION(FatalProfileException,SHIBSP_EXCEPTIONAPI(SHIBSP_API),opensaml,ProfileException,Fatal exceptions in SAML profile processing);