SSPCPP-616 - clean up concatenated string literals
[shibboleth/cpp-sp.git] / shibsp / handler / impl / SessionInitiator.cpp
index 50413bd..3110ec7 100644 (file)
@@ -82,6 +82,11 @@ const char* SessionInitiator::getType() const
 
 void SessionInitiator::generateMetadata(SPSSODescriptor& role, const char* handlerURL) const
 {
+    // In case any plugins were directly calling this before, we stub it out.
+}
+
+void SessionInitiator::doGenerateMetadata(SPSSODescriptor& role, const char* handlerURL) const
+{
     if (getParent())
         return;
     const char* loc = getString("Location").second;
@@ -143,6 +148,8 @@ bool SessionInitiator::checkCompatibility(SPRequest& request, bool isHandler) co
 
 pair<bool,long> SessionInitiator::run(SPRequest& request, bool isHandler) const
 {
+    cleanRelayState(request.getApplication(), request, request);
+
     const char* entityID = nullptr;
     pair<bool,const char*> param = getString("entityIDParam");
     if (isHandler) {
@@ -201,3 +208,30 @@ pair<bool,long> SessionInitiator::run(SPRequest& request, bool isHandler) const
         throw;
     }
 }
+
+#ifndef SHIBSP_LITE
+
+AuthnRequestEvent* SessionInitiator::newAuthnRequestEvent(const Application& application, const xmltooling::HTTPRequest* request) const
+{
+    if (!SPConfig::getConfig().isEnabled(SPConfig::Logging))
+        return nullptr;
+    try {
+        auto_ptr<TransactionLog::Event> event(SPConfig::getConfig().EventManager.newPlugin(AUTHNREQUEST_EVENT, nullptr));
+        AuthnRequestEvent* ar_event = dynamic_cast<AuthnRequestEvent*>(event.get());
+        if (ar_event) {
+            ar_event->m_request = request;
+            ar_event->m_app = &application;
+            event.release();
+            return ar_event;
+        }
+        else {
+            Category::getInstance(SHIBSP_LOGCAT ".SessionInitiator").warn("unable to audit event, log event object was of an incorrect type");
+        }
+    }
+    catch (exception& ex) {
+        Category::getInstance(SHIBSP_LOGCAT ".SessionInitiator").warn("exception auditing event: %s", ex.what());
+    }
+    return nullptr;
+}
+
+#endif