00001 #ifndef EDG_WORKLOAD_USERINTERFACE_CLIENT_USERCREDENTIAL_H
00002 #define EDG_WORKLOAD_USERINTERFACE_CLIENT_USERCREDENTIAL_H
00003
00004
00005
00006
00007
00008
00009
00010
00011 #include <vector>
00012 #include <sys/stat.h>
00013 #include <exception>
00014 #include "edg/workload/userinterface/client/userinterface_namespace.h"
00015
00016 #include "voms_api.h"
00017
00018 #define DEFAULT_SECURE_TMP_DIR "/tmp"
00019 #define FILE_SEPERATOR "/"
00020 #define PROXY_TIME_LIMIT 600 // minumin time-left proxy value accepted
00021
00022 typedef struct proxy_cred_desc_struct proxy_cred_desc ;
00023
00024
00025
00026
00027 USERINTERFACE_NAMESPACE_BEGIN
00051 class UserCredential{
00052 public:
00054 UserCredential() {};
00060 int checkProxy (const std::string& cred_path="") ;
00066 std::string getIssuer (const std::string& cred_path="") ;
00072 std::string getSubject (const std::string& cred_path="");
00078 int getCredType (const std::string& cred_path="") ;
00084 int getStrenght (const std::string& cred_path="") ;
00090 int getTimeLeft (const std::string& cred_path="");
00101 void getInfo( std::string& subj,
00102 std::string& issuer,
00103 int& cred_type,
00104 int& strength,
00105 int& time_left,
00106 const std::string& cred_path = "") ;
00112 void destroy(const std::string& cred_path = "") ;
00113
00114
00115
00116
00117
00120 std::string getDefaultVoName ();
00121
00124 std::vector <std::string> getVoNames ();
00125
00126
00127
00128
00129 std::vector <std::string> getGroups ( const std::string& voName ) ;
00130
00133 std::vector <std::string > getDefaultGroups () ;
00134
00139 bool containsVo ( const std::string& voName ) ;
00140
00141
00142
00143 private:
00144 proxy_cred_desc * pcd ;
00145 char * proxy_file ;
00146 struct stat stx;
00147 static pthread_mutex_t mutex;
00148 void load_voms ( vomsdata& d ) ;
00149 static std::vector <std::string> load_groups( voms &v ) ;
00150 };
00151 USERINTERFACE_NAMESPACE_END }
00152 #endif