- //setHeader("Shib-Attributes", reinterpret_cast<char*>(serialized));
- // TODO: export lookup URLs to access assertions by ID
- const vector<const char*>& tokens = session->getAssertionIDs();
+ const PropertySet* sessions=app->getPropertySet("Sessions");
+ pair<bool,const char*> exportLocation = sessions ? sessions->getString("exportLocation") : pair<bool,const char*>(false,NULL);
+ if (!exportLocation.first)
+ log.warn("can't export assertions without an exportLocation Sessions property");
+ else {
+ const URLEncoder* encoder = XMLToolingConfig::getConfig().getURLEncoder();
+ string exportName = "Shib-Assertion-00";
+ string baseURL;
+ if (!strncmp(exportLocation.second, "http", 4))
+ baseURL = exportLocation.second;
+ else
+ baseURL = string(request.getHandlerURL(targetURL.c_str())) + exportLocation.second;
+ baseURL = baseURL + "?key=" + session->getID() + "&ID=";
+ const vector<const char*>& tokens = session->getAssertionIDs();
+ vector<const char*>::size_type count = 0;
+ for (vector<const char*>::const_iterator tokenids = tokens.begin(); tokenids!=tokens.end(); ++tokenids) {
+ count++;
+ *(exportName.rbegin()) = '0' + (count%10);
+ *(++exportName.rbegin()) = '0' + (count/10);
+ string fullURL = baseURL + encoder->encode(*tokenids);
+ request.setHeader(exportName.c_str(), fullURL.c_str());
+ }
+ request.setHeader("Shib-Assertion-Count", exportName.c_str() + 15);
+ }