[cpp-sp] 02/02: Add constants for homeURL access.
Scott Cantor
cantor.2 at osu.edu
Thu Nov 6 17:13:21 UTC 2025
This is an automated email from the git hooks/post-receive script.
scantor pushed a commit to branch main
in repository cpp-sp.
View the commit online:
https://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=2bfecc22ad905a3f9e9d40286433af9581f10ed7
commit 2bfecc22ad905a3f9e9d40286433af9581f10ed7
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Thu Nov 6 12:13:15 2025 -0500
Add constants for homeURL access.
---
shibsp/RequestMapper.h | 2 ++
shibsp/handler/impl/AttributeCheckerHandler.cpp | 3 ++-
shibsp/handler/impl/SessionInitiator.cpp | 4 +++-
shibsp/handler/impl/TokenConsumer.cpp | 6 +++---
shibsp/impl/XMLRequestMapper.cpp | 2 ++
5 files changed, 12 insertions(+), 5 deletions(-)
diff --git a/shibsp/RequestMapper.h b/shibsp/RequestMapper.h
index c7f9e6c8..d81b91dd 100644
--- a/shibsp/RequestMapper.h
+++ b/shibsp/RequestMapper.h
@@ -56,6 +56,7 @@ namespace shibsp {
static const char COOKIE_MAXAGE_PROP_NAME[];
static const char EXPIRE_REDIRECTS_PROP_NAME[];
static const char HANDLER_CONFIG_ID_PROP_NAME[];
+ static const char HOME_URL_PROP_NAME[];
static const char LIFETIME_PROP_NAME[];
static const char PRESERVE_POST_DATA_PROP_NAME[];
static const char POST_LIMIT_PROP_NAME[];
@@ -75,6 +76,7 @@ namespace shibsp {
static const char ATTRIBUTE_VALUE_DELIMITER_PROP_DEFAULT[];
static bool CONSISTENT_ADDRESS_PROP_DEFAULT;
static bool EXPIRE_REDIRECTS_PROP_DEFAULT;
+ static const char HOME_URL_PROP_DEFAULT[];
static unsigned int LIFETIME_PROP_DEFAULT;
static bool PRESERVE_POST_DATA_PROP_DEFAULT;
static unsigned int POST_LIMIT_PROP_DEFAULT;
diff --git a/shibsp/handler/impl/AttributeCheckerHandler.cpp b/shibsp/handler/impl/AttributeCheckerHandler.cpp
index 877d9f42..69b40d22 100644
--- a/shibsp/handler/impl/AttributeCheckerHandler.cpp
+++ b/shibsp/handler/impl/AttributeCheckerHandler.cpp
@@ -117,7 +117,8 @@ pair<bool,long> AttributeCheckerHandler::run(SPRequest& request, bool isHandler)
request.limitRedirect(returnURL);
}
else {
- returnURL = request.getRequestSettings().first->getString("homeURL", "/");
+ returnURL = request.getRequestSettings().first->getString(
+ RequestMapper::HOME_URL_PROP_NAME, RequestMapper::HOME_URL_PROP_DEFAULT);
}
unique_lock<Session> session;
diff --git a/shibsp/handler/impl/SessionInitiator.cpp b/shibsp/handler/impl/SessionInitiator.cpp
index e361ba1a..722cfb48 100644
--- a/shibsp/handler/impl/SessionInitiator.cpp
+++ b/shibsp/handler/impl/SessionInitiator.cpp
@@ -130,7 +130,9 @@ pair<bool,long> SessionInitiator::run(SPRequest& request, bool isHandler) const
}
else {
// target will come from query string, map, or handler or fall back to homeURL.
- target = getString("target", request, request.getRequestSettings().first->getString("homeURL", "/"));
+ target = getString("target", request,
+ request.getRequestSettings().first->getString(
+ RequestMapper::HOME_URL_PROP_NAME, RequestMapper::HOME_URL_PROP_DEFAULT));
// handler is derived from the target resource.
handlerBaseURL = request.getHandlerURL(target.c_str());
diff --git a/shibsp/handler/impl/TokenConsumer.cpp b/shibsp/handler/impl/TokenConsumer.cpp
index 2f1b47da..df1d0153 100644
--- a/shibsp/handler/impl/TokenConsumer.cpp
+++ b/shibsp/handler/impl/TokenConsumer.cpp
@@ -90,7 +90,7 @@ pair<bool,long> TokenConsumer::run(SPRequest& request, bool isHandler) const
target = param.first->second;
}
else {
- target = getString("homeURL", request, "/", HANDLER_PROPERTY_FIXED | HANDLER_PROPERTY_MAP);
+ target = getString(RequestMapper::HOME_URL_PROP_NAME, request, RequestMapper::HOME_URL_PROP_DEFAULT, HANDLER_PROPERTY_MAP);
}
request.limitRedirect(target.c_str());
return make_pair(true, request.sendRedirect(target.c_str()));
@@ -118,8 +118,8 @@ pair<bool,long> TokenConsumer::run(SPRequest& request, bool isHandler) const
target = s;
}
else if (!output.getmember("http.response.data").string()) {
- // Shouldn't happen, but we can route ourselves to homeURL or /
- target = getString("homeURL", request, "/", HANDLER_PROPERTY_FIXED | HANDLER_PROPERTY_MAP);
+ // Shouldn't happen, but we can route ourselves to homeURL.
+ target = getString(RequestMapper::HOME_URL_PROP_NAME, request, RequestMapper::HOME_URL_PROP_DEFAULT, HANDLER_PROPERTY_MAP);
output.addmember("http.redirect").unsafe_string(target.c_str());
}
diff --git a/shibsp/impl/XMLRequestMapper.cpp b/shibsp/impl/XMLRequestMapper.cpp
index dee3e474..05453ba6 100644
--- a/shibsp/impl/XMLRequestMapper.cpp
+++ b/shibsp/impl/XMLRequestMapper.cpp
@@ -174,6 +174,7 @@ const char RequestMapper::AUTH_TYPE_PROP_NAME[] = "authType";
const char RequestMapper::CONSISTENT_ADDRESS_PROP_NAME[] = "consistentAddress";
const char RequestMapper::COOKIE_MAXAGE_PROP_NAME[] = "cookieMaxAge";
const char RequestMapper::HANDLER_CONFIG_ID_PROP_NAME[] = "handlerConfigId";
+const char RequestMapper::HOME_URL_PROP_NAME[] = "homeURL";
const char RequestMapper::EXPIRE_REDIRECTS_PROP_NAME[] = "expireRedirects";
const char RequestMapper::LIFETIME_PROP_NAME[] = "lifetime";
const char RequestMapper::PRESERVE_POST_DATA_PROP_NAME[] = "preservePostData";
@@ -194,6 +195,7 @@ const char RequestMapper::APPLICATION_ID_PROP_DEFAULT[] = "default";
const char RequestMapper::ATTRIBUTE_VALUE_DELIMITER_PROP_DEFAULT[] = ";";
bool RequestMapper::CONSISTENT_ADDRESS_PROP_DEFAULT = true;
bool RequestMapper::EXPIRE_REDIRECTS_PROP_DEFAULT = true;
+const char RequestMapper::HOME_URL_PROP_DEFAULT[] = "/";
unsigned int RequestMapper::LIFETIME_PROP_DEFAULT = 3600 * 8;
bool RequestMapper::PRESERVE_POST_DATA_PROP_DEFAULT = false;
unsigned int RequestMapper::POST_LIMIT_PROP_DEFAULT = 1024 * 1024;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list