X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=saml%2Fsaml2%2Fbinding%2Fimpl%2FSAML2ArtifactDecoder.cpp;h=42882cb5faeddf6b439b2b30cc99f3fc638967f5;hb=932cfaae2176c2eba1a9938dc420591a9551a7f3;hp=1cd434e89293a0689ef88119e2c0661dcf7d145f;hpb=1bc8e721db3a50294df852662e1eddcdbdae8f9f;p=shibboleth%2Fcpp-opensaml.git diff --git a/saml/saml2/binding/impl/SAML2ArtifactDecoder.cpp b/saml/saml2/binding/impl/SAML2ArtifactDecoder.cpp index 1cd434e..42882cb 100644 --- a/saml/saml2/binding/impl/SAML2ArtifactDecoder.cpp +++ b/saml/saml2/binding/impl/SAML2ArtifactDecoder.cpp @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006 Internet2 + * Copyright 2001-2007 Internet2 * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -53,8 +53,6 @@ namespace opensaml { SAML2ArtifactDecoder::SAML2ArtifactDecoder(const DOMElement* e) {} -SAML2ArtifactDecoder::~SAML2ArtifactDecoder() {} - XMLObject* SAML2ArtifactDecoder::decode( string& relayState, const GenericRequest& genericRequest, @@ -126,33 +124,33 @@ XMLObject* SAML2ArtifactDecoder::decode( auto_ptr_char issuer(provider->getEntityID()); log.debug("lookup succeeded, artifact issued by (%s)", issuer.get()); } + + // Mock up an Issuer object for the policy. + auto_ptr issuer(IssuerBuilder::buildIssuer()); + issuer->setName(provider->getEntityID()); + policy.setIssuer(issuer.get()); + issuer.release(); // owned by policy now log.debug("attempting to find artifact issuing role..."); const RoleDescriptor* roledesc=provider->getRoleDescriptor(*(policy.getRole()), samlconstants::SAML20P_NS); if (!roledesc || !dynamic_cast(roledesc)) { log.error("unable to find compatible SAML role (%s) in metadata", policy.getRole()->toString().c_str()); - BindingException ex("Unable to find compatible metadata role for artifact issuer."); - annotateException(&ex,provider); // throws it + throw BindingException("Unable to find compatible metadata role for artifact issuer."); } + policy.setIssuerMetadata(roledesc); - try { - auto_ptr response( - m_artifactResolver->resolve(*(artifact2.get()), dynamic_cast(*roledesc), policy) - ); - - policy.evaluate(genericRequest, *(response.get())); + auto_ptr response( + m_artifactResolver->resolve(*(artifact2.get()), dynamic_cast(*roledesc), policy) + ); + + // The policy should be enforced against the ArtifactResponse by the resolve step. - // Extract payload and check that message. - XMLObject* payload = response->getPayload(); - policy.evaluate(genericRequest, *payload); + // Extract payload and check that message. + XMLObject* payload = response->getPayload(); + policy.evaluate(*payload, &genericRequest); - // Return the payload only. - response.release(); - payload->detach(); - return payload; - } - catch (XMLToolingException& ex) { - annotateException(&ex,roledesc,false); - throw; - } + // Return the payload only. + response.release(); + payload->detach(); + return payload; }