00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 #ifndef ROOT_THostAuth
00013 #define ROOT_THostAuth
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef ROOT_TObject
00027 #include "TObject.h"
00028 #endif
00029 #ifndef ROOT_TString
00030 #include "TString.h"
00031 #endif
00032 #ifndef ROOT_TList
00033 #include "TList.h"
00034 #endif
00035 #ifndef ROOT_TRootSecContext
00036 #include "TRootSecContext.h"
00037 #endif
00038 #ifndef ROOT_AuthConst
00039 #include "AuthConst.h"
00040 #endif
00041
00042
00043
00044 class THostAuth : public TObject {
00045
00046 private:
00047 TString fHost;
00048 Char_t fServer;
00049 TString fUser;
00050 Int_t fNumMethods;
00051 Int_t fMethods[kMAXSEC];
00052 TString fDetails[kMAXSEC];
00053 Int_t fSuccess[kMAXSEC];
00054 Int_t fFailure[kMAXSEC];
00055 Bool_t fActive;
00056
00057 TList *fSecContexts;
00058
00059 void Create(const char *host, const char *user, Int_t nmeth = 0,
00060 Int_t *authmeth = 0, char **details = 0);
00061 public:
00062
00063 THostAuth();
00064 THostAuth(const char *host, const char *user,
00065 Int_t nmeth = 0, Int_t *authmeth = 0, char **details = 0);
00066 THostAuth(const char *host, Int_t server, const char *user,
00067 Int_t nmeth = 0, Int_t *authmeth = 0, char **details = 0);
00068 THostAuth(const char *host, const char *user, Int_t authmeth,
00069 const char *details);
00070 THostAuth(const char *host, Int_t server, const char *user, Int_t authmeth,
00071 const char *details);
00072 THostAuth(const char *asstring);
00073 THostAuth(THostAuth &ha);
00074
00075 virtual ~THostAuth();
00076
00077 void AsString(TString &out) const;
00078
00079 Int_t NumMethods() const { return fNumMethods; }
00080 Int_t GetMethod(Int_t idx) const { return fMethods[idx]; }
00081 Bool_t HasMethod(Int_t level, Int_t *pos = 0);
00082 void AddMethod(Int_t level, const char *details = 0);
00083 void RemoveMethod(Int_t level);
00084 void ReOrder(Int_t nmet, Int_t *fmet);
00085 void Update(THostAuth *ha);
00086 void SetFirst(Int_t level);
00087 void AddFirst(Int_t level, const char *details = 0);
00088 void SetLast(Int_t level);
00089 void CountFailure(Int_t level);
00090 void CountSuccess(Int_t level);
00091 Int_t GetFailure(Int_t idx) const { return fFailure[idx]; }
00092 Int_t GetSuccess(Int_t idx) const { return fSuccess[idx]; }
00093 Bool_t IsActive() const { return fActive; }
00094 void DeActivate() { fActive = kFALSE; }
00095 void Activate() { fActive = kTRUE; }
00096 void Reset();
00097
00098 const char *GetDetails(Int_t level);
00099 const char *GetDetailsByIdx(Int_t idx) const { return fDetails[idx]; }
00100 void SetDetails(Int_t level, const char *details);
00101
00102 const char *GetHost() const { return fHost; }
00103 Int_t GetServer() const { return (Int_t)fServer; }
00104 const char *GetUser() const { return fUser; }
00105
00106 void SetHost(const char *host) { fHost = host; }
00107 void SetServer(Int_t server) { fServer = (Char_t)server; }
00108 void SetUser(const char *user) { fUser = user; }
00109
00110 TList *Established() const { return fSecContexts; }
00111 void SetEstablished(TList *nl) { fSecContexts = nl; }
00112
00113 virtual void Print(Option_t *option = "") const;
00114 void PrintEstablished() const;
00115
00116 TRootSecContext *CreateSecContext(const char *user, const char *host, Int_t meth,
00117 Int_t offset, const char *details,
00118 const char *token, TDatime expdate = kROOTTZERO,
00119 void *ctx = 0, Int_t key = -1);
00120
00121 ClassDef(THostAuth,1)
00122 };
00123
00124 #endif