/*
- * Copyright 2001-2007 Internet2
+ * Copyright 2001-2009 Internet2
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* SAML2ECPEncoder.cpp
*
- * SAML 2.0 ECP profile message encoder
+ * SAML 2.0 ECP profile message encoder.
*/
#include "internal.h"
#include <xmltooling/impl/AnyElement.h>
#include <xmltooling/io/HTTPResponse.h>
#include <xmltooling/util/NDC.h>
+#include <xmltooling/signature/Signature.h>
#include <xmltooling/soap/SOAP.h>
using namespace samlconstants;
genericResponse.setContentType(request ? "application/vnd.paos+xml" : "text/xml");
HTTPResponse* httpResponse = dynamic_cast<HTTPResponse*>(&genericResponse);
if (httpResponse) {
+ httpResponse->setResponseHeader("Expires", "01-Jan-1997 12:00:00 GMT");
httpResponse->setResponseHeader("Cache-Control", "no-cache, no-store, must-revalidate, private");
httpResponse->setResponseHeader("Pragma", "no-cache");
}
body->getUnknownXMLObjects().push_back(xmlObject);
ElementProxy* hdrblock;
- QName qMU(SOAP11ENV_NS, Header::MUSTUNDERSTAND_ATTRIB_NAME, SOAP11ENV_PREFIX);
- QName qActor(SOAP11ENV_NS, Header::ACTOR_ATTRIB_NAME, SOAP11ENV_PREFIX);
+ xmltooling::QName qMU(SOAP11ENV_NS, Header::MUSTUNDERSTAND_ATTRIB_NAME, SOAP11ENV_PREFIX);
+ xmltooling::QName qActor(SOAP11ENV_NS, Header::ACTOR_ATTRIB_NAME, SOAP11ENV_PREFIX);
if (request) {
// Create paos:Request header.
hdrblock = dynamic_cast<ElementProxy*>(m_anyBuilder.buildObject(PAOS_NS, saml1p::Request::LOCAL_NAME, PAOS_PREFIX));
hdrblock->setAttribute(qMU, XML_ONE);
hdrblock->setAttribute(qActor, m_actor.get());
- hdrblock->setAttribute(QName(NULL, service), SAML20ECP_NS);
- hdrblock->setAttribute(QName(NULL, responseConsumerURL), request->getAssertionConsumerServiceURL());
+ hdrblock->setAttribute(xmltooling::QName(NULL, service), SAML20ECP_NS);
+ hdrblock->setAttribute(xmltooling::QName(NULL, responseConsumerURL), request->getAssertionConsumerServiceURL());
header->getUnknownXMLObjects().push_back(hdrblock);
// Create ecp:Request header.
hdrblock->setAttribute(qMU, XML_ONE);
hdrblock->setAttribute(qActor, m_actor.get());
if (!request->IsPassive())
- hdrblock->setAttribute(QName(NULL,IsPassive), XML_ZERO);
+ hdrblock->setAttribute(xmltooling::QName(NULL,IsPassive), XML_ZERO);
if (m_providerName)
- hdrblock->setAttribute(QName(NULL,ProviderName), m_providerName);
+ hdrblock->setAttribute(xmltooling::QName(NULL,ProviderName), m_providerName);
hdrblock->getUnknownXMLObjects().push_back(request->getIssuer()->clone());
if (request->getScoping() && request->getScoping()->getIDPList())
hdrblock->getUnknownXMLObjects().push_back(request->getScoping()->getIDPList()->clone());
hdrblock = dynamic_cast<ElementProxy*>(m_anyBuilder.buildObject(SAML20ECP_NS, Response::LOCAL_NAME, SAML20ECP_PREFIX));
hdrblock->setAttribute(qMU, XML_ONE);
hdrblock->setAttribute(qActor, m_actor.get());
- hdrblock->setAttribute(QName(NULL,AuthnRequest::ASSERTIONCONSUMERSERVICEURL_ATTRIB_NAME), response->getDestination());
+ hdrblock->setAttribute(xmltooling::QName(NULL,AuthnRequest::ASSERTIONCONSUMERSERVICEURL_ATTRIB_NAME), response->getDestination());
header->getUnknownXMLObjects().push_back(hdrblock);
}
- if (relayState) {
+ if (relayState && *relayState) {
// Create ecp:RelayState header.
static const XMLCh RelayState[] = UNICODE_LITERAL_10(R,e,l,a,y,S,t,a,t,e);
hdrblock = dynamic_cast<ElementProxy*>(m_anyBuilder.buildObject(SAML20ECP_NS, RelayState, SAML20ECP_PREFIX));
stringstream s;
s << *rootElement;
- if (log.isDebugEnabled())
- log.debug("marshalled envelope:\n%s", s.str().c_str());
+ if (log.isDebugEnabled()) {
+ string forlog(s.str());
+ log.debug("marshalled envelope:\n%s", forlog.c_str());
+ }
log.debug("sending serialized envelope");
long ret = genericResponse.sendResponse(s);