THostAuth.h

Go to the documentation of this file.
00001 // @(#)root/auth:$Id: THostAuth.h 20882 2007-11-19 11:31:26Z rdm $
00002 // Author: G. Ganis   19/03/2003
00003 
00004 /*************************************************************************
00005  * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers.               *
00006  * All rights reserved.                                                  *
00007  *                                                                       *
00008  * For the licensing terms see $ROOTSYS/LICENSE.                         *
00009  * For the list of contributors see $ROOTSYS/README/CREDITS.             *
00010  *************************************************************************/
00011 
00012 #ifndef ROOT_THostAuth
00013 #define ROOT_THostAuth
00014 
00015 
00016 //////////////////////////////////////////////////////////////////////////
00017 //                                                                      //
00018 // THostAuth                                                            //
00019 //                                                                      //
00020 // Contains details about host-specific authentication methods and the  //
00021 // result of their application                                          //
00022 // Used by TAuthenticate                                                //
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;             // Host
00048    Char_t       fServer;           // Server (kSOCKD,kROOTD,kPROOFD)
00049    TString      fUser;             // Username
00050    Int_t        fNumMethods;       // Number of AuthMethods
00051    Int_t        fMethods[kMAXSEC]; // AuthMethods
00052    TString      fDetails[kMAXSEC]; // AuthDetails
00053    Int_t        fSuccess[kMAXSEC]; // Statistics of successful attempts / per method
00054    Int_t        fFailure[kMAXSEC]; // Statistics of failed attempts / per method
00055    Bool_t       fActive;           // Flag used in cleaning/reset
00056 
00057    TList       *fSecContexts;  // List of TSecContexts related to this THostAuth
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)  // Class providing host specific authentication information
00122 };
00123 
00124 #endif

Generated on Tue Jul 5 14:26:58 2011 for ROOT_528-00b_version by  doxygen 1.5.1