Logo ROOT  
Reference Guide
Go to the documentation of this file.
1// @(#)root/auth:$Id$
2// Author: G. Ganis 19/03/2003
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 *************************************************************************/
12#ifndef ROOT_THostAuth
13#define ROOT_THostAuth
17// //
18// THostAuth //
19// //
20// Contains details about host-specific authentication methods and the //
21// result of their application //
22// Used by TAuthenticate //
23// //
26#include "TObject.h"
27#include "TString.h"
28#include "TList.h"
29#include "TRootSecContext.h"
30#include "AuthConst.h"
32#include "TSecContext.h" // for kROOTTZERO.
34class THostAuth : public TObject {
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
47 TList *fSecContexts; // List of TSecContexts related to this THostAuth
49 void Create(const char *host, const char *user, Int_t nmeth = 0,
50 Int_t *authmeth = 0, char **details = 0);
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);
65 virtual ~THostAuth();
67 void AsString(TString &out) const;
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();
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);
92 const char *GetHost() const { return fHost; }
93 Int_t GetServer() const { return (Int_t)fServer; }
94 const char *GetUser() const { return fUser; }
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; }
100 TList *Established() const { return fSecContexts; }
103 void Print(Option_t *option = "") const override;
104 void PrintEstablished() const;
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);
111 ClassDefOverride(THostAuth,1) // Class providing host specific authentication information
const Int_t kMAXSEC
Definition: AuthConst.h:26
bool Bool_t
Definition: RtypesCore.h:63
int Int_t
Definition: RtypesCore.h:45
char Char_t
Definition: RtypesCore.h:37
const Bool_t kFALSE
Definition: RtypesCore.h:101
const Bool_t kTRUE
Definition: RtypesCore.h:100
const char Option_t
Definition: RtypesCore.h:66
#define ClassDefOverride(name, id)
Definition: Rtypes.h:339
Option_t Option_t option
Option_t Option_t TPoint TPoint const char GetTextMagnitude GetFillStyle GetLineColor GetLineWidth GetMarkerStyle GetTextAlign GetTextColor GetTextSize void char Point_t Rectangle_t WindowAttributes_t Float_t Float_t Float_t Int_t Int_t UInt_t UInt_t Rectangle_t Int_t Int_t Window_t TString Int_t GCValues_t GetPrimarySelectionOwner GetDisplay GetScreen GetColormap GetNativeEvent const char const char dpyName wid window const char font_name cursor keysym reg const char only_if_exist regb h Point_t winding char text const char depth char const char Int_t count const char ColorStruct_t color const char Pixmap_t Pixmap_t PictureAttributes_t attr const char char ret_data h unsigned char height h offset
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.
Definition: THostAuth.cxx:344
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...
Definition: THostAuth.cxx:723
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.
Definition: THostAuth.cxx:403
virtual ~THostAuth()
The dtor.
Definition: THostAuth.cxx:362
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 ...).
Definition: THostAuth.cxx:583
Int_t fFailure[kMAXSEC]
Definition: THostAuth.h:44
TString fDetails[kMAXSEC]
Definition: THostAuth.h:42
void Print(Option_t *option="") const override
Print object content.
Definition: THostAuth.cxx:424
void SetServer(Int_t server)
Definition: THostAuth.h:97
void ReOrder(Int_t nmet, Int_t *fmet)
Reorder nmet methods according fmet[nmet].
Definition: THostAuth.cxx:473
Default constructor.
Definition: THostAuth.cxx:37
void RemoveMethod(Int_t level)
Remove method 'meth' from the list, if there ...
Definition: THostAuth.cxx:310
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.
Definition: THostAuth.cxx:277
TString fHost
Definition: THostAuth.h:37
TString fUser
Definition: THostAuth.h:39
void CountFailure(Int_t level)
Count failures for 'method'.
Definition: THostAuth.cxx:708
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.
Definition: THostAuth.cxx:100
Bool_t IsActive() const
Definition: THostAuth.h:83
void AsString(TString &out) const
Return a static string with all info in a serialized form.
Definition: THostAuth.cxx:741
Bool_t HasMethod(Int_t level, Int_t *pos=0)
Return kTRUE if method 'level' is in the list.
Definition: THostAuth.cxx:387
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...
Definition: THostAuth.cxx:651
void Update(THostAuth *ha)
Update info with the one in ha Remaining methods, if any, get lower priority.
Definition: THostAuth.cxx:533
const char * GetDetails(Int_t level)
Return authentication details for specified level or "" if the specified level does not exist for thi...
Definition: THostAuth.cxx:371
void SetLast(Int_t level)
Set 'method' to be the last used (if in the list ...).
Definition: THostAuth.cxx:615
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.
Definition: THostAuth.cxx:448
void CountSuccess(Int_t level)
Count successes for 'method'.
Definition: THostAuth.cxx:694
A doubly linked list.
Definition: TList.h:38
Mother of all ROOT objects.
Definition: TObject.h:37
Basic string class.
Definition: TString.h:136