16 #include <boost/tokenizer.hpp>
23 LOG(
DEBUG) <<
"WsBasicAuth::WsBasicAuthInit() : Preparing required libraries : libgdcore ";
24 void* hndl = dlopen(
"libgdcore.so", RTLD_NOW | RTLD_GLOBAL);
26 LOG(
ERROR) <<
"WsBasicAuth::WsBasicAuthInit() : Cannot load libgdcore.so shared library! " << dlerror();
34 m_allGroups.insert(guest);
43 int ran = rand() % 10000000 + 1;
44 m_uid = m_uid +
"-" + boost::lexical_cast<
string>(ran);
45 m_groups.insert(guest);
84 typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
85 boost::char_separator<char> sep(
".");
86 tokenizer maskTok(ipMask, sep);
87 tokenizer uipTok(ip, sep);
88 tokenizer::iterator mask_iter = maskTok.begin();
89 tokenizer::iterator ip_iter = uipTok.begin();
90 for (; ip_iter != uipTok.end(); ++mask_iter, ++ip_iter) {
91 if (mask_iter == maskTok.end())
93 if (*mask_iter ==
"*")
95 if (*ip_iter != *mask_iter)
WsBasicAuth()
Constructor.
std::string getEmail()
Get the email of the user.
std::set< std::string > getUserGroups()
get the groups of the user
bool ipValid(std::string ip)
return true or false whether the ip is valid (ie match the mask in the configuration file ...
int authentify(const std::string &uid, const std::string &pass="", const std::string &ip="")
authenticate the user this function is a basic function and will authenticate any user and add the gr...
void WsBasicAuthInit(void)
std::string getFirstName()
Get the first name of the user.
std::set< std::string > getAllGroups()
get all the groups in the ldap
std::string get(const std::string §ion, const std::string &id, const std::string &def)
std::string getSurname()
Get the surname of the user.
static WsGlobalProperties * instance()
std::string getUid()
Get the uid of the user.