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
34namespace ROOT::Deprecated {
35
36class THostAuth : public TObject {
37
38private:
39 TString fHost; // Host
40 Char_t fServer; // Server (kSOCKD,kROOTD)
41 TString fUser; // Username
42 Int_t fNumMethods; // Number of AuthMethods
43 Int_t fMethods[kMAXSEC]; // AuthMethods
44 TString fDetails[kMAXSEC]; // AuthDetails
45 Int_t fSuccess[kMAXSEC]; // Statistics of successful attempts / per method
46 Int_t fFailure[kMAXSEC]; // Statistics of failed attempts / per method
47 Bool_t fActive; // Flag used in cleaning/reset
48
49 TList *fSecContexts; // List of TSecContexts related to this THostAuth
50
51 void Create(const char *host, const char *user, Int_t nmeth = 0,
52 Int_t *authmeth = nullptr, char **details = nullptr);
53public:
54
55 THostAuth();
56 THostAuth(const char *host, const char *user,
57 Int_t nmeth = 0, Int_t *authmeth = nullptr, char **details = nullptr);
58 THostAuth(const char *host, Int_t server, const char *user,
59 Int_t nmeth = 0, Int_t *authmeth = nullptr, char **details = nullptr);
60 THostAuth(const char *host, const char *user, Int_t authmeth,
61 const char *details);
62 THostAuth(const char *host, Int_t server, const char *user, Int_t authmeth,
63 const char *details);
65
66 virtual ~THostAuth();
67
68 void AsString(TString &out) const;
69
70 Int_t NumMethods() const { return fNumMethods; }
71 Int_t GetMethod(Int_t idx) const { return fMethods[idx]; }
72 Bool_t HasMethod(Int_t level, Int_t *pos = nullptr);
73 void AddMethod(Int_t level, const char *details = nullptr);
74 void RemoveMethod(Int_t level);
75 void ReOrder(Int_t nmet, Int_t *fmet);
76 void Update(THostAuth *ha);
77 void SetFirst(Int_t level);
78 void AddFirst(Int_t level, const char *details = nullptr);
79 void SetLast(Int_t level);
80 void CountFailure(Int_t level);
81 void CountSuccess(Int_t level);
82 Int_t GetFailure(Int_t idx) const { return fFailure[idx]; }
83 Int_t GetSuccess(Int_t idx) const { return fSuccess[idx]; }
84 Bool_t IsActive() const { return fActive; }
86 void Activate() { fActive = kTRUE; }
87 void Reset();
88
89 const char *GetDetails(Int_t level);
90 const char *GetDetailsByIdx(Int_t idx) const { return fDetails[idx]; }
91 void SetDetails(Int_t level, const char *details);
92
93 const char *GetHost() const { return fHost; }
94 Int_t GetServer() const { return (Int_t)fServer; }
95 const char *GetUser() const { return fUser; }
96
97 void SetHost(const char *host) { fHost = host; }
99 void SetUser(const char *user) { fUser = user; }
100
101 TList *Established() const { return fSecContexts; }
103
104 void Print(Option_t *option = "") const override;
105 void PrintEstablished() const;
106
107 TRootSecContext *CreateSecContext(const char *user, const char *host, Int_t meth,
108 Int_t offset, const char *details,
109 const char *token, TDatime expdate = kROOTTZERO,
110 void *ctx = nullptr, Int_t key = -1);
111
112 ClassDefOverride(THostAuth,1) // Class providing host specific authentication information
113};
114
115} // namespace ROOT::Deprecated
116
117using THostAuth R__DEPRECATED(6, 42, "the RootAuth library is deprecated") = ROOT::Deprecated::THostAuth;
118
119#endif
#define R__DEPRECATED(MAJOR, MINOR, REASON)
Definition RConfig.hxx:510
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 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
void RemoveMethod(Int_t level)
Remove method 'meth' from the list, if there ...
void CountSuccess(Int_t level)
Count successes for 'method'.
Int_t GetMethod(Int_t idx) const
Definition THostAuth.h:71
TString fDetails[kMAXSEC]
Definition THostAuth.h:44
THostAuth()
Default constructor.
Definition THostAuth.cxx:36
Int_t fMethods[kMAXSEC]
Definition THostAuth.h:43
Bool_t IsActive() const
Definition THostAuth.h:84
virtual ~THostAuth()
The dtor.
void AsString(TString &out) const
Return a static string with all info in a serialized form.
void SetEstablished(TList *nl)
Definition THostAuth.h:102
const char * GetDetailsByIdx(Int_t idx) const
Definition THostAuth.h:90
Int_t GetSuccess(Int_t idx) const
Definition THostAuth.h:83
void CountFailure(Int_t level)
Count failures for 'method'.
void SetHost(const char *host)
Definition THostAuth.h:97
void AddMethod(Int_t level, const char *details=nullptr)
Add method to the list.
Int_t fFailure[kMAXSEC]
Definition THostAuth.h:46
void Update(THostAuth *ha)
Update info with the one in ha Remaining methods, if any, get lower priority.
void Create(const char *host, const char *user, Int_t nmeth=0, Int_t *authmeth=nullptr, char **details=nullptr)
Create hostauth object.
Definition THostAuth.cxx:99
Int_t GetFailure(Int_t idx) const
Definition THostAuth.h:82
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...
TList * Established() const
Definition THostAuth.h:101
const char * GetDetails(Int_t level)
Return authentication details for specified level or "" if the specified level does not exist for thi...
void SetFirst(Int_t level)
Set 'method' to be the first used (if in the list ...).
void ReOrder(Int_t nmet, Int_t *fmet)
Reorder nmet methods according fmet[nmet].
Bool_t HasMethod(Int_t level, Int_t *pos=nullptr)
Return kTRUE if method 'level' is in the list.
void SetUser(const char *user)
Definition THostAuth.h:99
void SetServer(Int_t server)
Definition THostAuth.h:98
void Reset()
Remove all methods, leaving Active status and list of associted TSceContexts unchanged.
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...
Int_t fSuccess[kMAXSEC]
Definition THostAuth.h:45
void SetLast(Int_t level)
Set 'method' to be the last used (if in the list ...).
void SetDetails(Int_t level, const char *details)
Set authentication details for specified level.
const char * GetUser() const
Definition THostAuth.h:95
const char * GetHost() const
Definition THostAuth.h:93
void Print(Option_t *option="") const override
Print object content.
void PrintEstablished() const
Print info about established authentication vis-a-vis of this Host.
This class stores the date and time with a precision of one second in an unsigned 32 bit word (950130...
Definition TDatime.h:37
A doubly linked list.
Definition TList.h:38
Mother of all ROOT objects.
Definition TObject.h:42
Basic string class.
Definition TString.h:138
const Int_t kMAXSEC
Definition AuthConst.h:28