00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_TAuthenticate
00013 #define ROOT_TAuthenticate
00014
00015
00017
00018
00019
00020
00021
00022
00024
00025 #ifndef ROOT_TObject
00026 #include "TObject.h"
00027 #endif
00028 #ifndef ROOT_TString
00029 #include "TString.h"
00030 #endif
00031
00032
00033 class TSocket;
00034
00035 typedef Int_t (*SecureAuth_t)(TSocket *sock, const char *user,
00036 const char *passwd, const char *remote);
00037 typedef Int_t (*Krb5Auth_t)(TSocket *sock, TString &user);
00038
00039
00040 class TAuthenticate : public TObject {
00041
00042 public:
00043 enum ESecurity { kClear, kSRP, kKrb5 };
00044
00045 private:
00046 TString fUser;
00047 TString fPasswd;
00048 TString fProtocol;
00049 TString fRemote;
00050 TSocket *fSocket;
00051 ESecurity fSecurity;
00052
00053 static TString fgUser;
00054 static TString fgPasswd;
00055 static SecureAuth_t fgSecAuthHook;
00056 static Krb5Auth_t fgKrb5AuthHook;
00057
00058 public:
00059 TAuthenticate(TSocket *sock, const char *remote, const char *proto,
00060 Int_t security);
00061 virtual ~TAuthenticate() { }
00062
00063 Bool_t Authenticate();
00064 Bool_t CheckNetrc(TString &user, TString &passwd);
00065 const char *GetUser() const { return fUser.Data(); }
00066 const char *GetPasswd() const { return fPasswd.Data(); }
00067
00068 static const char *GetGlobalUser();
00069 static const char *GetGlobalPasswd();
00070 static void SetGlobalUser(const char *user);
00071 static void SetGlobalPasswd(const char *passwd);
00072 static char *PromptUser(const char *remote);
00073 static char *PromptPasswd(const char *prompt = "Password: ");
00074 static void SetSecureAuthHook(SecureAuth_t func);
00075 static void SetKrb5AuthHook(Krb5Auth_t func);
00076 static void AuthError(const char *where, Int_t error);
00077
00078 ClassDef(TAuthenticate,0)
00079 };
00080
00081 #endif