text
stringlengths 0
2.2M
|
---|
{
|
if(allprovs.at(cntpra).getTagName()=="providers")
|
{
|
ElementList provs = allprovs.at(cntpra).getChildElements();
|
for (unsigned int cntpr = 0; cntpr < provs.size(); cntpr++)
|
{
|
if(provs.at(cntpr).getTagName()!="provider")
|
continue;
|
std::string provName = provs.at(cntpr).getAttribute("name");
|
if(provName=="")
|
{
|
logger << ("No name provided for security-provider, skipping...") << std::endl;
|
continue;
|
}
|
if(ConfigurationData::getInstance()->securityObjectMap.find(name)!=ConfigurationData::getInstance()->securityObjectMap.end()
|
&& ConfigurationData::getInstance()->securityObjectMap[name].find(provName)!=ConfigurationData::getInstance()->securityObjectMap[name].end())
|
{
|
logger << ("Security-provider already exists, skipping duplicate...") << std::endl;
|
continue;
|
}
|
ElementList cntrls = provs.at(cntpr).getChildElements();
|
for (unsigned int cntn = 0; cntn < cntrls.size(); cntn++)
|
{
|
if(cntrls.at(cntn).getTagName()=="login-handler")
|
{
|
std::string provider = cntrls.at(cntn).getAttribute("provider");
|
std::string url = cntrls.at(cntn).getAttribute("path");
|
std::string sessionTimeoutV = cntrls.at(cntn).getAttribute("sessionTimeout");
|
std::string scope = cntrls.at(cntn).getAttribute("scope");
|
Security securityObject = ConfigurationData::getInstance()->securityObjectMap[name][provName];
|
securityObject.loginProvider = provider;
|
normalizeUrl(name, url);
|
securityObject.loginUrl = url;
|
try {
|
securityObject.sessTimeout = CastUtil::toLong(sessionTimeoutV);
|
} catch(const std::exception& e) {
|
securityObject.sessTimeout = 3600;
|
logger << ("Security: Invalid session timeout value defined, defaulting to 1hour/3600sec") << std::endl;
|
}
|
ConfigurationData::getInstance()->securityObjectMap[name][provName] = securityObject;
|
if(provider!="" && provider.find("class:")!=std::string::npos)
|
{
|
std::string clas = provider.substr(provider.find(":")+1);
|
Bean bean(clas,"",clas,scope,false,false,name);
|
ConfigurationData::getInstance()->ffeadContext.addBean(bean);
|
}
|
logger << ("Security: Adding Login Handler => " + url + " , provider => " + provider) << std::endl;
|
}
|
else if(cntrls.at(cntn).getTagName()=="secure")
|
{
|
Security securityObject = ConfigurationData::getInstance()->securityObjectMap[name][provName];
|
std::string path = cntrls.at(cntn).getAttribute("path");
|
std::string role = cntrls.at(cntn).getAttribute("role");
|
SecureAspect secureAspect;
|
normalizeUrl(name, path);
|
secureAspect.path = path;
|
secureAspect.role = role;
|
if(securityObject.addAspect(secureAspect))
|
{
|
ConfigurationData::getInstance()->securityObjectMap[name][provName] = securityObject;
|
logger << ("Security: Adding Secure Path => " + path + " , role => " + role) << std::endl;
|
}
|
}
|
else if(cntrls.at(cntn).getTagName()=="welcome")
|
{
|
std::string welcomeFile = cntrls.at(cntn).getAttribute("file");
|
Security securityObject = ConfigurationData::getInstance()->securityObjectMap[name][provName];
|
securityObject.welcomeFile = welcomeFile;
|
ConfigurationData::getInstance()->securityObjectMap[name][provName] = securityObject;
|
logger << ("Security: Adding Welcome file => " + welcomeFile) << std::endl;
|
}
|
else if(cntrls.at(cntn).getTagName()=="username")
|
{
|
std::string ffrom = cntrls.at(cntn).getAttribute("from");
|
std::string fname = cntrls.at(cntn).getAttribute("name");
|
if(ffrom!="reqparam" && ffrom!="postparam" && ffrom!="header" && fname!="")
|
{
|
Security securityObject = ConfigurationData::getInstance()->securityObjectMap[name][provName];
|
securityObject.securityFieldNames["username"] = fname;
|
securityObject.securityFieldFrom["username"] = ffrom;
|
ConfigurationData::getInstance()->securityObjectMap[name][provName] = securityObject;
|
}
|
}
|
else if(cntrls.at(cntn).getTagName()=="password")
|
{
|
std::string ffrom = cntrls.at(cntn).getAttribute("from");
|
std::string fname = cntrls.at(cntn).getAttribute("name");
|
if(ffrom!="reqparam" && ffrom!="postparam" && ffrom!="header" && fname!="")
|
{
|
Security securityObject = ConfigurationData::getInstance()->securityObjectMap[name][provName];
|
securityObject.securityFieldNames["password"] = fname;
|
securityObject.securityFieldFrom["password"] = ffrom;
|
ConfigurationData::getInstance()->securityObjectMap[name][provName] = securityObject;
|
}
|
}
|
}
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.