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)
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 = nullptr, char **details = nullptr);
51public:
52
53 THostAuth();
54 THostAuth(const char *host, const char *user,
55 Int_t nmeth = 0, Int_t *authmeth = nullptr, char **details = nullptr);
56 THostAuth(const char *host, Int_t server, const char *user,
57 Int_t nmeth = 0, Int_t *authmeth = nullptr, char **details = nullptr);
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);
63
64 virtual ~THostAuth();
65
66 void AsString(TString &out) const;
67
68 Int_t NumMethods() const { return fNumMethods; }
69 Int_t GetMethod(Int_t idx) const { return fMethods[idx]; }
70 Bool_t HasMethod(Int_t level, Int_t *pos = nullptr);
71 void AddMethod(Int_t level, const char *details = nullptr);
72 void RemoveMethod(Int_t level);
73 void ReOrder(Int_t nmet, Int_t *fmet);
74 void Update(THostAuth *ha);
75 void SetFirst(Int_t level);
76 void AddFirst(Int_t level, const char *details = nullptr);
77 void SetLast(Int_t level);
78 void CountFailure(Int_t level);
79 void CountSuccess(Int_t level);
80 Int_t GetFailure(Int_t idx) const { return fFailure[idx]; }
81 Int_t GetSuccess(Int_t idx) const { return fSuccess[idx]; }
82 Bool_t IsActive() const { return fActive; }
84 void Activate() { fActive = kTRUE; }
85 void Reset();
86
87 const char *GetDetails(Int_t level);
88 const char *GetDetailsByIdx(Int_t idx) const { return fDetails[idx]; }
89 void SetDetails(Int_t level, const char *details);
90
91 const char *GetHost() const { return fHost; }
92 Int_t GetServer() const { return (Int_t)fServer; }
93 const char *GetUser() const { return fUser; }
94
95 void SetHost(const char *host) { fHost = host; }
97 void SetUser(const char *user) { fUser = user; }
98
99 TList *Established() const { return fSecContexts; }
101
102 void Print(Option_t *option = "") const override;
103 void PrintEstablished() const;
104
105 TRootSecContext *CreateSecContext(const char *user, const char *host, Int_t meth,
106 Int_t offset, const char *details,
107 const char *token, TDatime expdate = kROOTTZERO,
108 void *ctx = nullptr, Int_t key = -1);
109
110 ClassDefOverride(THostAuth,1) // Class providing host specific authentication information
111};
112
113#endif
const Int_t kMAXSEC
Definition AuthConst.h:26
bool Bool_t
Boolean (0=false, 1=true) (bool)
Definition RtypesCore.h:77
int Int_t
Signed integer 4 bytes (int)
Definition RtypesCore.h:59
char Char_t
Character 1 byte (char)
Definition RtypesCore.h:51
constexpr Bool_t kFALSE
Definition RtypesCore.h:108
constexpr Bool_t kTRUE
Definition RtypesCore.h:107
const char Option_t
Option string (const char)
Definition RtypesCore.h:80
#define ClassDefOverride(name, id)
Definition Rtypes.h:348
ROOT::Detail::TRangeCast< T, true > TRangeDynCast
TRangeDynCast is an adapter class that allows the typed iteration through a TCollection.
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
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:84
Bool_t fActive
Definition THostAuth.h:45
Int_t fSuccess[kMAXSEC]
Definition THostAuth.h:43
const char * GetUser() const
Definition THostAuth.h:93
void Create(const char *host, const char *user, Int_t nmeth=0, Int_t *authmeth=nullptr, char **details=nullptr)
Create hostauth object.
TList * fSecContexts
Definition THostAuth.h:47
Int_t NumMethods() const
Definition THostAuth.h:68
void Reset()
Remove all methods, leaving Active status and list of associted TSceContexts unchanged.
Char_t fServer
Definition THostAuth.h:38
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=nullptr, Int_t key=-1)
Create a Security context and add it to local list Return pointer to it to be stored in TAuthenticate...
const char * GetHost() const
Definition THostAuth.h:91
void AddMethod(Int_t level, const char *details=nullptr)
Add method to the list.
Int_t GetServer() const
Definition THostAuth.h:92
void SetUser(const char *user)
Definition THostAuth.h:97
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:95
Int_t fMethods[kMAXSEC]
Definition THostAuth.h:41
void SetFirst(Int_t level)
Set 'method' to be the first used (if in the list ...).
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.
void SetServer(Int_t server)
Definition THostAuth.h:96
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:83
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:81
void AddFirst(Int_t level, const char *details=nullptr)
Add new method in first position If already in the list, set as first method 'level' with authenticat...
Int_t GetMethod(Int_t idx) const
Definition THostAuth.h:69
Bool_t IsActive() const
Definition THostAuth.h:82
Bool_t HasMethod(Int_t level, Int_t *pos=nullptr)
Return kTRUE if method 'level' is in the list.
void AsString(TString &out) const
Return a static string with all info in a serialized form.
TList * Established() const
Definition THostAuth.h:99
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:80
void SetEstablished(TList *nl)
Definition THostAuth.h:100
const char * GetDetailsByIdx(Int_t idx) const
Definition THostAuth.h:88
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:138