00001 /// @file core/builtin/Authn.h 00002 /// @brief User and group mapping using the system's ones. 00003 /// @details This will be used by default when no other Authn 00004 /// implementeation is loaded. 00005 /// @author Alejandro Álvarez Ayllon <aalvarez@cern.ch> 00006 #ifndef BUILTIN_AUTHN_H 00007 #define BUILTIN_AUTHN_H 00008 00009 #include <dmlite/cpp/authn.h> 00010 00011 namespace dmlite { 00012 00013 class BuiltInAuthn: public Authn { 00014 public: 00015 BuiltInAuthn(const std::string&, const std::string&); 00016 ~BuiltInAuthn(); 00017 00018 std::string getImplId(void) const throw(); 00019 00020 virtual SecurityContext* createSecurityContext(const SecurityCredentials& cred) throw (DmException); 00021 virtual SecurityContext* createSecurityContext() throw (DmException); 00022 00023 GroupInfo newGroup (const std::string& gname) throw (DmException); 00024 GroupInfo getGroup (gid_t gid) throw (DmException); 00025 GroupInfo getGroup (const std::string& groupName) throw (DmException); 00026 GroupInfo getGroup (const std::string& key, 00027 const boost::any& value) throw (DmException); 00028 void updateGroup(const GroupInfo& group) throw (DmException); 00029 void deleteGroup(const std::string& groupName) throw (DmException); 00030 00031 UserInfo newUser (const std::string& uname) throw (DmException); 00032 UserInfo getUser (const std::string& userName) throw (DmException); 00033 UserInfo getUser (const std::string& userName, 00034 gid_t* group) throw (DmException); 00035 UserInfo getUser (const std::string& key, 00036 const boost::any& value) throw (DmException); 00037 void updateUser(const UserInfo& user) throw (DmException); 00038 void deleteUser(const std::string& userName) throw (DmException); 00039 00040 std::vector<GroupInfo> getGroups(void) throw (DmException); 00041 std::vector<UserInfo> getUsers (void) throw (DmException); 00042 00043 void getIdMap(const std::string& userName, 00044 const std::vector<std::string>& groupNames, 00045 UserInfo* user, 00046 std::vector<GroupInfo>* groups) throw (DmException); 00047 private: 00048 std::string nobody_; 00049 std::string nogroup_; 00050 }; 00051 00052 class BuiltInAuthnFactory: public AuthnFactory { 00053 public: 00054 BuiltInAuthnFactory(); 00055 ~BuiltInAuthnFactory(); 00056 00057 void configure(const std::string& key, const std::string& value) throw (DmException); 00058 00059 Authn* createAuthn(PluginManager* pm) throw (DmException); 00060 00061 private: 00062 std::string nobody_; 00063 std::string nogroup_; 00064 }; 00065 00066 }; 00067 00068 #endif // BUILTIN_AUTHN_H