[cpp-sp] branch master updated: SSPCPP-350 - Modular configuration

Scott Cantor cantor.2 at osu.edu
Wed Apr 11 16:21:39 EDT 2018


This is an automated email from the git hooks/post-receive script.

scantor pushed a commit to branch master
in repository cpp-sp.

View the commit online:
http://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=295e2118467519e62fd40bd26c476b79c114bebb

The following commit(s) were added to refs/heads/master by this push:
       new  295e211   SSPCPP-350 - Modular configuration
295e211 is described below

commit 295e2118467519e62fd40bd26c476b79c114bebb
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Wed Apr 11 16:20:14 2018 -0400

    SSPCPP-350 - Modular configuration
    
    https://issues.shibboleth.net/jira/browse/SSPCPP-350
    
    Host-substitution in entityIDSelf setting.
---
 shibsp/handler/impl/RemotedHandler.cpp         |  9 +++++++--
 shibsp/handler/impl/SAMLDSSessionInitiator.cpp | 14 ++++++++++++--
 shibsp/handler/impl/WAYFSessionInitiator.cpp   | 14 ++++++++++++--
 3 files changed, 31 insertions(+), 6 deletions(-)

diff --git a/shibsp/handler/impl/RemotedHandler.cpp b/shibsp/handler/impl/RemotedHandler.cpp
index 4f8bec4..9d5556a 100644
--- a/shibsp/handler/impl/RemotedHandler.cpp
+++ b/shibsp/handler/impl/RemotedHandler.cpp
@@ -366,8 +366,13 @@ DDF RemotedHandler::send(const SPRequest& request, DDF& in) const
 {
     // Capture and forward entityIDSelf content setting, if set.
     pair<bool, const char*> entityID = request.getRequestSettings().first->getString("entityIDSelf");
-    if (entityID.first)
-        in.addmember("_mapped.entityID").string(entityID.second);
+    if (entityID.first) {
+        string s(entityID.second);
+        string::size_type pos = s.find("$hostname");
+        if (pos != string::npos)
+            s.replace(pos, 9, request.getHostname());
+        in.addmember("_mapped.entityID").string(s.c_str());
+    }
 
     return request.getServiceProvider().getListenerService()->send(in);
 }
diff --git a/shibsp/handler/impl/SAMLDSSessionInitiator.cpp b/shibsp/handler/impl/SAMLDSSessionInitiator.cpp
index 9fb8019..9e8d53d 100644
--- a/shibsp/handler/impl/SAMLDSSessionInitiator.cpp
+++ b/shibsp/handler/impl/SAMLDSSessionInitiator.cpp
@@ -273,9 +273,19 @@ pair<bool,long> SAMLDSSessionInitiator::run(SPRequest& request, string& entityID
     }
 
     // Check for content-specific SP entityID before falling back to app default.
+    string transformed;
     prop = getString("entityIDSelf", request, HANDLER_PROPERTY_MAP);
-    if (!prop.first)
-    	prop = app.getString("entityID");
+    if (prop.first) {
+        transformed = prop.second;
+        string::size_type pos = transformed.find("$hostname");
+        if (pos != string::npos) {
+            transformed.replace(pos, 9, request.getHostname());
+            prop.second = transformed.c_str();
+        }
+    }
+    else {
+        prop = app.getString("entityID");
+    }
 
     string req=string(discoveryURL.second) + (strchr(discoveryURL.second,'?') ? '&' : '?') + "entityID=" + urlenc->encode(prop.second) +
         "&return=" + urlenc->encode(returnURL.c_str());
diff --git a/shibsp/handler/impl/WAYFSessionInitiator.cpp b/shibsp/handler/impl/WAYFSessionInitiator.cpp
index 2e1d084..3ced3f5 100644
--- a/shibsp/handler/impl/WAYFSessionInitiator.cpp
+++ b/shibsp/handler/impl/WAYFSessionInitiator.cpp
@@ -178,9 +178,19 @@ pair<bool,long> WAYFSessionInitiator::run(SPRequest& request, string& entityID,
         target = "default";
 
     // Check for content-specific SP entityID before falling back to app default.
+    string transformed;
     prop = getString("entityIDSelf", request, HANDLER_PROPERTY_MAP);
-    if (!prop.first)
-    	prop = app.getString("entityID");
+    if (prop.first) {
+        transformed = prop.second;
+        string::size_type pos = transformed.find("$hostname");
+        if (pos != string::npos) {
+            transformed.replace(pos, 9, request.getHostname());
+            prop.second = transformed.c_str();
+        }
+    }
+    else {
+        prop = app.getString("entityID");
+    }
 
     const URLEncoder* urlenc = XMLToolingConfig::getConfig().getURLEncoder();
     string req=string(discoveryURL.second) + (strchr(discoveryURL.second,'?') ? '&' : '?') + "shire=" + urlenc->encode(ACSloc.c_str()) +

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the commits mailing list