[cpp-sp COMMIT] in /branches/REL_2/shibsp/handler/impl: ExternalAuthHandler.cpp SecuredHandler.cpp SessionHandler.cpp
noreply at shibboleth.net
noreply at shibboleth.net
Fri May 11 21:01:39 BST 2012
Author: scantor
Date: Fri May 11 21:01:39 2012
New Revision: 3657
URL: http://svn.shibboleth.net/view/cpp-sp?rev=3657&view=rev
Log:
https://issues.shibboleth.net/jira/browse/SSPCPP-361
Modified:
branches/REL_2/shibsp/handler/impl/ExternalAuthHandler.cpp
branches/REL_2/shibsp/handler/impl/SecuredHandler.cpp
branches/REL_2/shibsp/handler/impl/SessionHandler.cpp
Modified: branches/REL_2/shibsp/handler/impl/ExternalAuthHandler.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibsp/handler/impl/ExternalAuthHandler.cpp?rev=3657&r1=3656&r2=3657&view=diff
==============================================================================
--- branches/REL_2/shibsp/handler/impl/ExternalAuthHandler.cpp (original)
+++ branches/REL_2/shibsp/handler/impl/ExternalAuthHandler.cpp Fri May 11 21:01:39 2012
@@ -124,38 +124,40 @@
};
-static ostream& json_safe(ostream& os, const char* buf)
-{
- os << '"';
- for (; *buf; ++buf) {
- switch (*buf) {
- case '\\':
- case '"':
- os << '\\';
- os << *buf;
- break;
- case '\b':
- os << "\\b";
- break;
- case '\t':
- os << "\\t";
- break;
- case '\n':
- os << "\\n";
- break;
- case '\f':
- os << "\\f";
- break;
- case '\r':
- os << "\\r";
- break;
- default:
- os << *buf;
- }
- }
- os << '"';
- return os;
-}
+namespace {
+ static ostream& json_safe(ostream& os, const char* buf)
+ {
+ os << '"';
+ for (; *buf; ++buf) {
+ switch (*buf) {
+ case '\\':
+ case '"':
+ os << '\\';
+ os << *buf;
+ break;
+ case '\b':
+ os << "\\b";
+ break;
+ case '\t':
+ os << "\\t";
+ break;
+ case '\n':
+ os << "\\n";
+ break;
+ case '\f':
+ os << "\\f";
+ break;
+ case '\r':
+ os << "\\r";
+ break;
+ default:
+ os << *buf;
+ }
+ }
+ os << '"';
+ return os;
+ }
+};
ExternalAuth::ExternalAuth(const DOMElement* e, const char* appId)
: SecuredHandler(e, Category::getInstance(SHIBSP_LOGCAT".ExternalAuth"), "acl", "127.0.0.1 ::1")
Modified: branches/REL_2/shibsp/handler/impl/SecuredHandler.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibsp/handler/impl/SecuredHandler.cpp?rev=3657&r1=3656&r2=3657&view=diff
==============================================================================
--- branches/REL_2/shibsp/handler/impl/SecuredHandler.cpp (original)
+++ branches/REL_2/shibsp/handler/impl/SecuredHandler.cpp Fri May 11 21:01:39 2012
@@ -103,7 +103,7 @@
if (conf.isEnabled(SPConfig::InProcess) && !m_acl.empty()) {
static bool (IPRange::* contains)(const char*) const = &IPRange::contains;
if (find_if(m_acl.begin(), m_acl.end(), boost::bind(contains, _1, request.getRemoteAddr().c_str())) == m_acl.end()) {
- m_log.error("handler request blocked from invalid address (%s)", request.getRemoteAddr().c_str());
+ request.log(SPRequest::SPWarn, string("handler request blocked from invalid address (") + request.getRemoteAddr() + ')');
istringstream msg("Access Denied");
return make_pair(true, request.sendResponse(msg, HTTPResponse::XMLTOOLING_HTTP_STATUS_FORBIDDEN));
}
Modified: branches/REL_2/shibsp/handler/impl/SessionHandler.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibsp/handler/impl/SessionHandler.cpp?rev=3657&r1=3656&r2=3657&view=diff
==============================================================================
--- branches/REL_2/shibsp/handler/impl/SessionHandler.cpp (original)
+++ branches/REL_2/shibsp/handler/impl/SessionHandler.cpp Fri May 11 21:01:39 2012
@@ -55,7 +55,11 @@
pair<bool,long> run(SPRequest& request, bool isHandler=true) const;
private:
+ pair<bool,long> doHTML(SPRequest& request) const;
+ pair<bool,long> doJSON(SPRequest& request) const;
+
bool m_values;
+ string m_contentType;
};
#if defined (_MSC_VER)
@@ -72,10 +76,51 @@
SessionHandler::SessionHandler(const DOMElement* e, const char* appId)
: SecuredHandler(e, Category::getInstance(SHIBSP_LOGCAT".SessionHandler")), m_values(false)
{
+ pair<bool,const char*> prop = getString("contentType");
+ if (prop.first)
+ m_contentType = prop.second;
+ if (!m_contentType.empty() && m_contentType != "application/json" && m_contentType != "text/html")
+ throw ConfigurationException("Unsupported contentType property in Session Handler configuration.");
+
[... 243 lines stripped ...]
More information about the commits
mailing list