// GssCredentialManager.h #ifndef dset__GssCredentialManager_H #define dset__GssCredentialManager_H // Class to manage GSI credential. It manages a map of credentials // indexed by user (DN for GSI) and maps credentials to threads. // // All methods return 0 for success. #include #include "dataset_credential/GssCredential.h" namespace dset { class GssCredentialManager { public: // typedefs typedef std::string Name; private: // functions GssCredentialManager(); public: // static functions: credential repository // Insert a credential. // The credentail is copied. // If there is already a credential with the same name, it is // removed. // Returns 0 for success. static int insert(const GssCredential& cred); // Remove a credential. // The entry is erased and the object deleted. static int remove(Name name); // Number of credentials stored. static int size(); // Get the credential corresponding to a name. static GssCredential* get(Name name); public: // static functions: thread specific // Insert the default credential and use its name for // the current thread. static int set_default(); // Set the credential name for the current thread. // The name need not exist in the current credential map. // Returns 0 for success. static int set_name(Name name); // Unset the credential name for the current thread. // Returns 0 for success. static int unset_name(); // Return the credential name for this thread. // Zero if none is set. static Name name(); // Set the owner for the credential name associated with // this thread. CSC is updated if successful. // Returns 0 for success. static int set_owner(Name owner); // Return the owner for this thread. // Extracted from the CSC using the credential name. static Name owner(); public: // static function: combined operations // Return the credential for this thread. // Zero if none is set. static GssCredential* credential(); }; }; // end namespace dset #endif