Wittyshare  0.2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
WsBasicAuth.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 
22 #include <Auth/WsAbstractAuth.h>
23 
27 class WsBasicAuth: public WsAbstractAuth {
28 public:
29 
33  WsBasicAuth();
34 
45  int authentify(const std::string& uid, const std::string& pass = "", const std::string& ip = "");
46 
52  std::string getUid();
53 
59  std::string getFirstName();
60 
66  std::string getSurname();
67 
71  std::string getEmail();
72 
76  std::set<std::string> getUserGroups();
77 
81  std::set<std::string> getAllGroups();
82 
83 protected:
88  bool ipValid(std::string ip);
89 
90 private:
91  std::string m_uid;
92  std::string m_name;
93  std::string m_surname;
94  std::string m_email;
95  std::string m_dn;
96  std::string m_ip;
97  std::set<std::string> m_groups;
98  std::set<std::string> m_allGroups;
100 
101 };
102 
103 extern "C" {
104  void WsBasicAuthInit(void) __attribute__((constructor));
106  {
107  return new WsBasicAuth();
108  }
109 }
110 
111 
112 
113 
114 #endif
Global properties.
WsBasicAuth()
Constructor.
Definition: WsBasicAuth.cpp:31
std::string getEmail()
Get the email of the user.
Definition: WsBasicAuth.cpp:64
std::set< std::string > getUserGroups()
get the groups of the user
Definition: WsBasicAuth.cpp:69
bool ipValid(std::string ip)
return true or false whether the ip is valid (ie match the mask in the configuration file ...
Definition: WsBasicAuth.cpp:79
WsBasicAuth * buildModule()
Definition: WsBasicAuth.h:105
Global properties class.
std::set< std::string > m_allGroups
Definition: WsBasicAuth.h:98
std::string m_ip
Definition: WsBasicAuth.h:96
WsGlobalProperties * m_properties
Definition: WsBasicAuth.h:99
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...
Definition: WsBasicAuth.cpp:37
std::string getFirstName()
Get the first name of the user.
Definition: WsBasicAuth.cpp:54
std::string m_name
Definition: WsBasicAuth.h:92
std::string m_email
Definition: WsBasicAuth.h:94
std::set< std::string > getAllGroups()
get all the groups in the ldap
Definition: WsBasicAuth.cpp:74
std::set< std::string > m_groups
Definition: WsBasicAuth.h:97
void WsBasicAuthInit(void) __attribute__((constructor))
Definition: WsBasicAuth.cpp:21
std::string getSurname()
Get the surname of the user.
Definition: WsBasicAuth.cpp:59
std::string m_dn
Definition: WsBasicAuth.h:95
Basic authentication module.
Definition: WsBasicAuth.h:27
Abstract class for authentification.
std::string getUid()
Get the uid of the user.
Definition: WsBasicAuth.cpp:49
std::string m_surname
Definition: WsBasicAuth.h:93
std::string m_uid
Definition: WsBasicAuth.h:91