#keypass=
calist=/opt/shibboleth/etc/shibboleth/ca-bundle.crt
+# The following shar items are for caching parameters
+cacheType=memory
+# how often to run the cache cleanup (in seconds) (300 == 5*60 == 5 minutes)
+cacheClean=300
+# idle timeout (in minutes) (240 == 8*60 == 8 hours)
+cacheTimeout=240
+
[extensions:saml]
eduPerson=/opt/shibboleth/lib/libeduPerson.so
[policies]
-InCommon=urn:mace:InCommon:pilot:2003
\ No newline at end of file
+InCommon=urn:mace:InCommon:pilot:2003
+
+[my.server.name]
+# list of attributes to request for server "my.server.name"
+# requests everything if this doesn't exist or is empty
+requestAttributes =
Mutex* mutex = Mutex::create();
saml::NDC ndc("InternalCCache::cleanup()");
+ ShibTargetConfig& config = ShibTargetConfig::getConfig();
+ ShibINI& ini = config.getINI();
+
+ int rerun_timer = 0;
+ int timeout_life = 0;
+
+ string tag;
+ if (ini.get_tag (SHIBTARGET_SHAR, SHIBTARGET_TAG_CACHECLEAN, true, &tag))
+ rerun_timer = atoi(tag.c_str());
+ if (ini.get_tag (SHIBTARGET_SHAR, SHIBTARGET_TAG_CACHETIMEOUT, true, &tag))
+ timeout_life = atoi(tag.c_str());
+
+ if (rerun_timer <= 0)
+ rerun_timer = 300; // rerun every 5 minutes
+
+ if (timeout_life <= 0)
+ timeout_life = 28800; // timeout after 8 hours
+
mutex->lock();
- log->debug("Cleanup thread started...");
+ log->debug("Cleanup thread started... Run every %d secs; timeout after %d secs",
+ rerun_timer, timeout_life);
while (shutdown == false) {
struct timespec ts;
memset (&ts, 0, sizeof(ts));
- ts.tv_sec = time(NULL) + 3600; // run every hour
+ ts.tv_sec = time(NULL) + rerun_timer;
shutdown_wait->timedwait(mutex, &ts);
// Pass 1: iterate over the map and find all entries that have not been
// used in X hours
vector<string> stale_keys;
- time_t stale = time(NULL) - 8 * 3600; // XXX: 8 hour timeout.
+ time_t stale = time(NULL) - timeout_life;
lock->rdlock();
for (map<string,InternalCCacheEntry*>::iterator i=m_hashtable.begin();
}
+ log->debug("Cleanup thread finished.");
+
mutex->unlock();
delete mutex;
Thread::exit(NULL);
}
// Initialize the SHAR Cache
- if (!strcmp (app_name, SHIBTARGET_SHAR))
- g_shibTargetCCache = CCache::getInstance(NULL);
+ if (!strcmp (app_name, SHIBTARGET_SHAR)) {
+ const char * cache_type = NULL;
+ if (ini->get_tag (app, SHIBTARGET_TAG_CACHETYPE, true, &tag))
+ cache_type = tag.c_str();
+
+ g_shibTargetCCache = CCache::getInstance(cache_type);
+ }
// Load any SAML extensions
string ext = "extensions:saml";
m_resource = m_url.substr(0, slash-str);
log->info("creating resource: \"%s\" -> \"%s\"", str, m_resource.c_str());
+
+ // Now figure out the designators
+ string server = m_url.substr(colon-str+3);
+
+ log->debug("server is \"%s\"", server.c_str());
+
+ ShibTargetConfig& config = ShibTargetConfig::getConfig();
+ ShibINI& ini = config.getINI();
+
+ string tag;
+ if (ini.get_tag (server, SHIBTARGET_TAG_REQATTRS, true, &tag)) {
+ // Now parse the request attributes tag...
+
+ const char * the_tag = tag.c_str();
+ const char * tag_ptr, *end_ptr;
+
+ // XXX: should we use strtok_r()?
+ for (tag_ptr = the_tag; tag_ptr && *tag_ptr; tag_ptr = end_ptr) {
+ end_ptr = strchr(tag_ptr, ' ');
+
+ // parse out the attribute substring
+ string a = tag.substr(the_tag-tag_ptr, (end_ptr ? end_ptr-tag_ptr : -1));
+ auto_ptr<XMLCh> temp(XMLString::transcode(a.c_str()));
+
+ log->debug ("Parsed attribute string: \"%s\"", a.c_str());
+
+ // Now create the SAML Attribute from this name
+
+
+ // and prepare for the next run through the loop.
+ if (end_ptr) end_ptr++;
+ }
+ }
}
ResourcePriv::~ResourcePriv() {}
#define SHIBTARGET_TAG_SITESCERT "sitesCertFile"
#define SHIBTARGET_TAG_SITESREFRESH "sitesRefresh"
+#define SHIBTARGET_TAG_CACHETYPE "cacheType"
+#define SHIBTARGET_TAG_CACHECLEAN "cacheClean"
+#define SHIBTARGET_TAG_CACHETIMEOUT "cacheTimeout"
+
+#define SHIBTARGET_TAG_REQATTRS "requestAttributes"
+
/* initialize and finalize the target library (return 0 on success, 1 on failure) */
int shib_target_initialize (const char* application, const char* ini_file);
void shib_target_finalize (void);