Logo ROOT  
Reference Guide
 
Loading...
Searching...
No Matches
THostAuth.h
Go to the documentation of this file.
1// @(#)root/auth:$Id$
2// Author: G. Ganis 19/03/2003
3
4/*************************************************************************
5 * Copyright (C) 1995-2000, Rene Brun and Fons Rademakers. *
6 * All rights reserved. *
7 * *
8 * For the licensing terms see $ROOTSYS/LICENSE. *
9 * For the list of contributors see $ROOTSYS/README/CREDITS. *
10 *************************************************************************/
11
12#ifndef ROOT_THostAuth
13#define ROOT_THostAuth
14
15
16//////////////////////////////////////////////////////////////////////////
17// //
18// THostAuth //
19// //
20// Contains details about host-specific authentication methods and the //
21// result of their application //
22// Used by TAuthenticate //
23// //
24//////////////////////////////////////////////////////////////////////////
25
26#include "TObject.h"
27#include "TString.h"
28#include "TList.h"
29#include "TRootSecContext.h"
30#include "AuthConst.h"
31
32#include "TSecContext.h" // for kROOTTZERO.
33
34class THostAuth : public TObject {
35
36private:
37 TString fHost; // Host
38 Char_t fServer; // Server (kSOCKD,kROOTD,kPROOFD)
39 TString fUser; // Username
40 Int_t fNumMethods; // Number of AuthMethods
41 Int_t fMethods[kMAXSEC]; // AuthMethods
42 TString fDetails[kMAXSEC]; // AuthDetails
43 Int_t fSuccess[kMAXSEC]; // Statistics of successful attempts / per method
44 Int_t fFailure[kMAXSEC]; // Statistics of failed attempts / per method
45 Bool_t fActive; // Flag used in cleaning/reset
46
47 TList *fSecContexts; // List of TSecContexts related to this THostAuth
48
49 void Create(const char *host, const char *user, Int_t nmeth = 0,
50 Int_t *authmeth = 0, char **details = 0);
51public:
52
53 THostAuth();
54 THostAuth(const char *host, const char *user,
55 Int_t nmeth = 0, Int_t *authmeth = 0, char **details = 0);
56 THostAuth(const char *host, Int_t server, const char *user,
57 Int_t nmeth = 0, Int_t *authmeth = 0, char **details = 0);
58 THostAuth(const char *host, const char *user, Int_t authmeth,
59 const char *details);
60 THostAuth(const char *host, Int_t server, const char *user, Int_t authmeth,
61 const char *details);
62 THostAuth(const char *asstring);
64
65 virtual ~THostAuth();
66
67 void AsString(TString &out) const;
68
69 Int_t NumMethods() const { return fNumMethods; }
70 Int_t GetMethod(Int_t idx) const { return fMethods[idx]; }
71 Bool_t HasMethod(Int_t level, Int_t *pos = 0);
72 void AddMethod(Int_t level, const char *details = 0);
73 void RemoveMethod(Int_t level);
74 void ReOrder(Int_t nmet, Int_t *fmet);
75 void Update(THostAuth *ha);
76 void SetFirst(Int_t level);
77 void AddFirst(Int_t level, const char *details = 0);
78 void SetLast(Int_t level);
79 void CountFailure(Int_t level);
80 void CountSuccess(Int_t level);
81 Int_t GetFailure(Int_t idx) const { return fFailure[idx]; }
82 Int_t GetSuccess(Int_t idx) const { return fSuccess[idx]; }
83 Bool_t IsActive() const { return fActive; }
85 void Activate() { fActive = kTRUE; }
86 void Reset();
87
88 const char *GetDetails(Int_t level);
89 const char *GetDetailsByIdx(Int_t idx) const { return fDetails[idx]; }
90 void SetDetails(Int_t level, const char *details);
91
92 const char *GetHost() const { return fHost; }
93 Int_t GetServer() const { return (Int_t)fServer; }
94 const char *GetUser() const { return fUser; }
95
96 void SetHost(const char *host) { fHost = host; }
97 void SetServer(Int_t server) { fServer = (Char_t)server; }
98 void SetUser(const char *user) { fUser = user; }
99
100 TList *Established() const { return fSecContexts; }
102
103 virtual void Print(Option_t *option = "") const;
104 void PrintEstablished() const;
105
106 TRootSecContext *CreateSecContext(const char *user, const char *host, Int_t meth,
107 Int_t offset, const char *details,
108 const char *token, TDatime expdate = kROOTTZERO,
109 void *ctx = 0, Int_t key = -1);
110
111 ClassDef(THostAuth,1) // Class providing host specific authentication information
112};
113
114#endif
const Int_t kMAXSEC
Definition AuthConst.h:26
int Int_t
Definition RtypesCore.h:45
char Char_t
Definition RtypesCore.h:37
const Bool_t kFALSE
Definition RtypesCore.h:101
bool Bool_t
Definition RtypesCore.h:63
const Bool_t kTRUE
Definition RtypesCore.h:100
const char Option_t
Definition RtypesCore.h:66
#define ClassDef(name, id)
Definition Rtypes.h:325
R__EXTERN const TDatime kROOTTZERO
Definition TSecContext.h:30
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
Definition TDatime.h:37
void Activate()
Definition THostAuth.h:85
Bool_t fActive
Definition THostAuth.h:45
Int_t fSuccess[kMAXSEC]
Definition THostAuth.h:43
const char * GetUser() const
Definition THostAuth.h:94
TList * fSecContexts
Definition THostAuth.h:47
Int_t NumMethods() const
Definition THostAuth.h:69
void Reset()
Remove all methods, leaving Active status and list of associted TSceContexts unchanged.
Char_t fServer
Definition THostAuth.h:38
const char * GetHost() const
Definition THostAuth.h:92
TRootSecContext * CreateSecContext(const char *user, const char *host, Int_t meth, Int_t offset, const char *details, const char *token, TDatime expdate=kROOTTZERO, void *ctx=0, Int_t key=-1)
Create a Security context and add it to local list Return pointer to it to be stored in TAuthenticate...
Int_t GetServer() const
Definition THostAuth.h:93
void SetUser(const char *user)
Definition THostAuth.h:98
void SetDetails(Int_t level, const char *details)
Set authentication details for specified level.
virtual ~THostAuth()
The dtor.
void SetHost(const char *host)
Definition THostAuth.h:96
Int_t fMethods[kMAXSEC]
Definition THostAuth.h:41
void SetFirst(Int_t level)
Set 'method' to be the first used (if in the list ...).
virtual void Print(Option_t *option="") const
Print object content.
Int_t fFailure[kMAXSEC]
Definition THostAuth.h:44
TString fDetails[kMAXSEC]
Definition THostAuth.h:42
void SetServer(Int_t server)
Definition THostAuth.h:97
void ReOrder(Int_t nmet, Int_t *fmet)
Reorder nmet methods according fmet[nmet].
THostAuth()
Default constructor.
Definition THostAuth.cxx:37
void RemoveMethod(Int_t level)
Remove method 'meth' from the list, if there ...
Int_t fNumMethods
Definition THostAuth.h:40
void DeActivate()
Definition THostAuth.h:84
void AddMethod(Int_t level, const char *details=0)
Add method to the list.
TString fHost
Definition THostAuth.h:37
TString fUser
Definition THostAuth.h:39
void CountFailure(Int_t level)
Count failures for 'method'.
Int_t GetSuccess(Int_t idx) const
Definition THostAuth.h:82
Int_t GetMethod(Int_t idx) const
Definition THostAuth.h:70
void Create(const char *host, const char *user, Int_t nmeth=0, Int_t *authmeth=0, char **details=0)
Create hostauth object.
Bool_t IsActive() const
Definition THostAuth.h:83
void AsString(TString &out) const
Return a static string with all info in a serialized form.
Bool_t HasMethod(Int_t level, Int_t *pos=0)
Return kTRUE if method 'level' is in the list.
TList * Established() const
Definition THostAuth.h:100
void AddFirst(Int_t level, const char *details=0)
Add new method in first position If already in the list, set as first method 'level' with authenticat...
void Update(THostAuth *ha)
Update info with the one in ha Remaining methods, if any, get lower priority.
const char * GetDetails(Int_t level)
Return authentication details for specified level or "" if the specified level does not exist for thi...
void SetLast(Int_t level)
Set 'method' to be the last used (if in the list ...).
Int_t GetFailure(Int_t idx) const
Definition THostAuth.h:81
void SetEstablished(TList *nl)
Definition THostAuth.h:101
const char * GetDetailsByIdx(Int_t idx) const
Definition THostAuth.h:89
void PrintEstablished() const
Print info about established authentication vis-a-vis of this Host.
void CountSuccess(Int_t level)
Count successes for 'method'.
A doubly linked list.
Definition TList.h:38
Mother of all ROOT objects.
Definition TObject.h:41
Basic string class.
Definition TString.h:136