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 SecurityContext* createSecurityContext(const SecurityCredentials& cred) throw (DmException); 00021 00022 GroupInfo newGroup (const std::string& gname) throw (DmException); 00023 GroupInfo getGroup (gid_t gid) throw (DmException); 00024 GroupInfo getGroup (const std::string& groupName) throw (DmException); 00025 GroupInfo getGroup (const std::string& key, 00026 const boost::any& value) throw (DmException); 00027 void updateGroup(const GroupInfo& group) throw (DmException); 00028 void deleteGroup(const std::string& groupName) throw (DmException); 00029 00030 UserInfo newUser (const std::string& uname) throw (DmException); 00031 UserInfo getUser (const std::string& userName) throw (DmException); 00032 UserInfo getUser (const std::string& userName, 00033 gid_t* group) throw (DmException); 00034 UserInfo getUser (const std::string& key, 00035 const boost::any& value) throw (DmException); 00036 void updateUser(const UserInfo& user) throw (DmException); 00037 void deleteUser(const std::string& userName) throw (DmException); 00038 00039 std::vector<GroupInfo> getGroups(void) throw (DmException); 00040 std::vector<UserInfo> getUsers (void) throw (DmException); 00041 00042 void getIdMap(const std::string& userName, 00043 const std::vector<std::string>& groupNames, 00044 UserInfo* user, 00045 std::vector<GroupInfo>* groups) throw (DmException); 00046 private: 00047 std::string nobody_; 00048 std::string nogroup_; 00049 }; 00050 00051 class BuiltInAuthnFactory: public AuthnFactory { 00052 public: 00053 BuiltInAuthnFactory(); 00054 ~BuiltInAuthnFactory(); 00055 00056 void configure(const std::string& key, const std::string& value) throw (DmException); 00057 00058 Authn* createAuthn(PluginManager* pm) throw (DmException); 00059 00060 private: 00061 std::string nobody_; 00062 std::string nogroup_; 00063 }; 00064 00065 }; 00066 00067 #endif // BUILTIN_AUTHN_H