Wittyshare  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WsLdapAuth.h
Go to the documentation of this file.
1 
14 #ifndef WS_LDAP_CONNECTOR_H__
15 #define WS_LDAP_CONNECTOR_H__
16 #include <set>
17 
18 #include <dlfcn.h>
19 
21 #include <gdcore/gdLdap.h>
22 
23 #include <Auth/WsAbstractAuth.h>
24 
28 class WsLdapAuth: public WsAbstractAuth {
29 public:
31 
35  WsLdapAuth();
36 
46  int authentify(const std::string& uid, const std::string& pass = "", const std::string& ip = "");
47 
53  std::string getUid();
54 
60  std::string getFirstName();
61 
67  std::string getSurname();
68 
72  std::string getEmail();
73 
77  std::set<std::string> getUserGroups();
78 
82  std::set<std::string> getAllGroups();
83 
84 protected:
89  bool ipValid(std::string ip);
90 
91 private:
92  std::string m_uid;
93  std::string m_name;
94  std::string m_surname;
95  std::string m_email;
96  std::string m_dn;
97  std::string m_ip;
98  std::set<std::string> m_groups;
99  std::set<std::string> m_allGroups;
102 
103 };
104 
105 extern "C" {
106  void WsLdapAuthInit(void) __attribute__((constructor));
108  {
109  return new WsLdapAuth();
110  }
111 }
112 
113 
114 
115 
116 #endif
Global properties.
bool ipValid(std::string ip)
return true or false whether the ip is valid (ie match the mask in the configuration file ...
Definition: WsLdapAuth.cpp:220
Global properties class.
std::string m_surname
Definition: WsLdapAuth.h:94
std::string m_ip
Definition: WsLdapAuth.h:97
std::string m_dn
Definition: WsLdapAuth.h:96
int authentify(const std::string &uid, const std::string &pass="", const std::string &ip="")
authenticate the user by retrieving his info from ldap
Definition: WsLdapAuth.cpp:36
Ldap authentication module.
Definition: WsLdapAuth.h:28
std::set< std::string > getUserGroups()
get the groups of the user
Definition: WsLdapAuth.cpp:177
std::set< std::string > m_allGroups
Definition: WsLdapAuth.h:99
WsGlobalProperties * m_properties
Definition: WsLdapAuth.h:100
std::string getSurname()
Get the surname of the user.
Definition: WsLdapAuth.cpp:167
std::string m_uid
Definition: WsLdapAuth.h:92
void WsLdapAuthInit(void) __attribute__((constructor))
Definition: WsLdapAuth.cpp:21
std::string m_name
Definition: WsLdapAuth.h:93
Abstract class for authentification.
std::string getUid()
Get the uid of the user.
Definition: WsLdapAuth.cpp:157
std::string m_email
Definition: WsLdapAuth.h:95
std::string getFirstName()
Get the first name of the user.
Definition: WsLdapAuth.cpp:162
std::set< std::string > getAllGroups()
get all the groups in the ldap
Definition: WsLdapAuth.cpp:182
WsLdapAuth()
Constructor.
Definition: WsLdapAuth.cpp:31
std::string getEmail()
Get the email of the user.
Definition: WsLdapAuth.cpp:172
WsLdapAuth * buildModule()
Definition: WsLdapAuth.h:107
std::set< std::string > m_groups
Definition: WsLdapAuth.h:98
loadStatus m_ldapStatus
Definition: WsLdapAuth.h:101