[cpp-sp] branch main updated: Add more content setting constants.
Scott Cantor
cantor.2 at osu.edu
Mon Jul 21 16:46:59 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:
http://git.shibboleth.net/view/?p=cpp-sp.git;a=commit;h=3d2ae35ce5c2b487045ed174de0088a3e75f14a8
The following commit(s) were added to refs/heads/main by this push:
new 3d2ae35c Add more content setting constants.
3d2ae35c is described below
commit 3d2ae35ce5c2b487045ed174de0088a3e75f14a8
Author: Scott Cantor <cantor.2 at osu.edu>
AuthorDate: Mon Jul 21 12:46:55 2025 -0400
Add more content setting constants.
---
shibsp/Agent.cpp | 26 ++++++++++++++------------
shibsp/RequestMapper.h | 6 ++++++
shibsp/impl/XMLRequestMapper.cpp | 6 ++++++
3 files changed, 26 insertions(+), 12 deletions(-)
diff --git a/shibsp/Agent.cpp b/shibsp/Agent.cpp
index 22d493c5..afe05276 100644
--- a/shibsp/Agent.cpp
+++ b/shibsp/Agent.cpp
@@ -69,7 +69,6 @@ Agent::~Agent()
long Agent::handleError(Category& log, SPRequest& request, const Session* session, exception* ex, bool mayRedirect) const
{
- // The properties we need can be set in the RequestMap, or the Errors element.
bool externalParameters = false;
const char* redirectErrors = nullptr;
@@ -92,9 +91,10 @@ long Agent::handleError(Category& log, SPRequest& request, const Session* sessio
// Now look for settings in the request map.
try {
RequestMapper::Settings settings = request.getRequestSettings();
+ // Not using this yet, probably TBD.
externalParameters = settings.first->getBool("externalParameters", false);
if (mayRedirect)
- redirectErrors = settings.first->getString("redirectErrors");
+ redirectErrors = settings.first->getString(RequestMapper::REDIRECT_ERRORS_PROP_NAME);
}
catch (const exception& nested) {
request.error(nested.what());
@@ -131,7 +131,7 @@ pair<bool,long> Agent::doAuthentication(SPRequest& request, bool handler) const
// If not SSL, check to see if we should block or redirect it.
if (!request.isSecure()) {
- const char* redirectToSSL = settings.first->getString("redirectToSSL");
+ const char* redirectToSSL = settings.first->getString(RequestMapper::REDIRECT_TO_SSL_PROP_NAME);
if (redirectToSSL) {
if (!strcasecmp("GET",request.getMethod()) || !strcasecmp("HEAD",request.getMethod())) {
// Compute the new target URL
@@ -166,9 +166,10 @@ pair<bool,long> Agent::doAuthentication(SPRequest& request, bool handler) const
}
// These settings dictate how to proceed.
- const char* authType = settings.first->getString("authType");
- bool requireSession = settings.first->getBool("requireSession", false);
- const char* requireLogoutWith = settings.first->getString("requireLogoutWith");
+ const char* authType = settings.first->getString(RequestMapper::AUTH_TYPE_PROP_NAME);
+ bool requireSession = settings.first->getBool(
+ RequestMapper::REQUIRE_SESSION_PROP_NAME, RequestMapper::REQUIRE_SESSION_PROP_DEFAULT);
+ const char* requireLogoutWith = settings.first->getString(RequestMapper::REQUIRE_LOGOUT_WITH_PROP_NAME);
// If no session is required AND the AuthType (an Apache-derived concept) isn't recognized,
// then we ignore this request and consider it unprotected. Apache might lie to us if
@@ -264,8 +265,9 @@ pair<bool,long> Agent::doAuthorization(SPRequest& request) const
RequestMapper::Settings settings = request.getRequestSettings();
// Three settings dictate how to proceed.
- const char* authType = settings.first->getString("authType");
- bool requireSession = settings.first->getBool("requireSession", false);
+ const char* authType = settings.first->getString(RequestMapper::AUTH_TYPE_PROP_NAME);
+ bool requireSession = settings.first->getBool(
+ RequestMapper::REQUIRE_SESSION_PROP_NAME, RequestMapper::REQUIRE_SESSION_PROP_DEFAULT);
// If no session is required AND the AuthType (an Apache-derived concept) isn't recognized,
// then we ignore this request and consider it unprotected. Apache might lie to us if
@@ -348,9 +350,9 @@ pair<bool,long> Agent::doExport(SPRequest& request, bool requireSession) const
request.setHeader("Shib-Session-ID", session.mutex()->getID());
request.setHeader("Shib-Application-ID", session.mutex()->getApplicationID());
- unsigned int lifetime = settings.first->getUnsignedInt("lifetime", 28800);
+ unsigned int lifetime = settings.first->getUnsignedInt(RequestMapper::LIFETIME_PROP_NAME, RequestMapper::LIFETIME_PROP_DEFAULT);
request.setHeader( "Shib-Session-Expires", boost::lexical_cast<string>(session.mutex()->getCreation() + lifetime).c_str());
- unsigned int timeout = settings.first->getUnsignedInt("timeout", 3600);
+ unsigned int timeout = settings.first->getUnsignedInt(RequestMapper::TIMEOUT_PROP_NAME, RequestMapper::TIMEOUT_PROP_DEFAULT);
if (timeout > 0) {
request.setHeader( "Shib-Session-Inactivity", boost::lexical_cast<string>(session.mutex()->getLastAccess() + timeout).c_str());
}
@@ -378,7 +380,7 @@ pair<bool,long> Agent::doHandler(SPRequest& request) const
// If not SSL, check to see if we should block or redirect it.
if (!request.isSecure()) {
- const char* redirectToSSL = settings.first->getString("redirectToSSL");
+ const char* redirectToSSL = settings.first->getString(RequestMapper::REDIRECT_TO_SSL_PROP_NAME);
if (redirectToSSL) {
if (!strcasecmp("GET",request.getMethod()) || !strcasecmp("HEAD",request.getMethod())) {
// Compute the new target URL
@@ -408,7 +410,7 @@ pair<bool,long> Agent::doHandler(SPRequest& request) const
// so the path info is the next character (or null).
const HandlerConfiguration& handlerConfig = request.getAgent().getHandlerConfiguration(
- request.getRequestSettings().first->getString("handlerConfigID"));
+ request.getRequestSettings().first->getString(RequestMapper::HANDLER_CONFIG_ID_PROP_NAME));
const Handler* handler = handlerConfig.getHandler(targetURL + strlen(handlerURL));
if (!handler) {
throw ConfigurationException("Shibboleth handler invoked at an unconfigured location.");
diff --git a/shibsp/RequestMapper.h b/shibsp/RequestMapper.h
index 80e41dc5..25783ba5 100644
--- a/shibsp/RequestMapper.h
+++ b/shibsp/RequestMapper.h
@@ -55,6 +55,11 @@ namespace shibsp {
typedef std::pair<const PropertySet*,AccessControl*> Settings;
static const char APPLICATION_ID_PROP_NAME[];
+ static const char AUTH_TYPE_PROP_NAME[];
+ static const char REDIRECT_ERRORS_PROP_NAME[];
+ static const char REDIRECT_TO_SSL_PROP_NAME[];
+ static const char REQUIRE_SESSION_PROP_NAME[];
+ static const char REQUIRE_LOGOUT_WITH_PROP_NAME[];
static const char HANDLER_CONFIG_ID_PROP_NAME[];
static const char ATTRIBUTE_CONFIG_ID_PROP_NAME[];
static const char SESSION_HOOK_PROP_NAME[];
@@ -65,6 +70,7 @@ namespace shibsp {
static const char SESSION_COOKIE_NAME_PROP_NAME[];
static const char APPLICATION_ID_PROP_DEFAULT[];
+ static bool REQUIRE_SESSION_PROP_DEFAULT;
static unsigned int LIFETIME_PROP_DEFAULT;
static unsigned int TIMEOUT_PROP_DEFAULT;
static bool CONSISTENT_ADDRESS_PROP_DEFAULT;
diff --git a/shibsp/impl/XMLRequestMapper.cpp b/shibsp/impl/XMLRequestMapper.cpp
index d287f436..2fbbf211 100644
--- a/shibsp/impl/XMLRequestMapper.cpp
+++ b/shibsp/impl/XMLRequestMapper.cpp
@@ -168,6 +168,11 @@ void SHIBSP_API shibsp::registerRequestMappers()
}
const char RequestMapper::APPLICATION_ID_PROP_NAME[] = "applicationId";
+const char RequestMapper::AUTH_TYPE_PROP_NAME[] = "authType";
+const char RequestMapper::REDIRECT_ERRORS_PROP_NAME[] = "redirectErrors";
+const char RequestMapper::REDIRECT_TO_SSL_PROP_NAME[] = "redirectToSSL";
+const char RequestMapper::REQUIRE_SESSION_PROP_NAME[] = "requireSession";
+const char RequestMapper::REQUIRE_LOGOUT_WITH_PROP_NAME[] = "requireLogoutWith";
const char RequestMapper::HANDLER_CONFIG_ID_PROP_NAME[] = "handlerConfigId";
const char RequestMapper::ATTRIBUTE_CONFIG_ID_PROP_NAME[] = "attributeConfigId";
const char RequestMapper::SESSION_HOOK_PROP_NAME[] = "sessionHook";
@@ -178,6 +183,7 @@ const char RequestMapper::COOKIE_MAXAGE_PROP_NAME[] = "cookieMaxAge";
const char RequestMapper::SESSION_COOKIE_NAME_PROP_NAME[] = "sessionCookieName";
const char RequestMapper::APPLICATION_ID_PROP_DEFAULT[] = "default";
+bool RequestMapper::REQUIRE_SESSION_PROP_DEFAULT = false;
unsigned int RequestMapper::LIFETIME_PROP_DEFAULT = 3600 * 8;
unsigned int RequestMapper::TIMEOUT_PROP_DEFAULT = 3600;
bool RequestMapper::CONSISTENT_ADDRESS_PROP_DEFAULT = true;
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the commits
mailing list