This program demonstrates access control to the THttpServer with digest methods.
Authentication file auth.txt was generated with following shell commands:
[shell] htdigest -
c auth.txt root guest
typing <empty> password for guest account
[shell] htdigest auth.txt root admin
typing 'admin' as password for admin account
When macro started and opening in browser with url
User name and password will be requested. One should either specify guest account without password or admin account with password 'admin'
User with guest account only can monitor histograms User with admin account see commands, which can be executed
void httpaccess()
{
TH1D *hpx =
new TH1D(
"hpx",
"This is the px distribution",100,-4,4);
TH2D *hpxpy =
new TH2D(
"hpxpy",
"py vs px",40,-4,4,40,-4,4);
printf("Please start macro from directory where auth.txt file is available\n");
printf("It required to supply authentication information for the http server\n");
return;
}
serv->
RegisterCommand(
"/ResetHPX",
"/hpx/->Reset();",
"button;rootsys/icons/ed_delete.png");
serv->
RegisterCommand(
"/ResetHPXPY",
"/hpxpy/->Reset();",
"button;rootsys/icons/bld_delete.png");
serv->
RegisterCommand(
"/RebinHPX",
"/hpx/->Rebin(%arg1%);",
"button;rootsys/icons/ed_execute.png");
serv->
Restrict(
"/ResetHPX",
"visible=admin");
serv->
Restrict(
"/ResetHPXPY",
"visible=admin");
serv->
Restrict(
"/RebinHPX",
"allow=admin");
}
}
}
R__EXTERN TSystem * gSystem
virtual void SetFillColor(Color_t fcolor)
Set the fill area color.
1-D histogram with a double per channel (see TH1 documentation)
virtual void SetDirectory(TDirectory *dir)
By default, when a histogram is created, it is added to the list of histogram objects in the current ...
virtual Int_t Fill(Double_t x)
Increment bin with abscissa X by 1.
2-D histogram with a double per channel (see TH1 documentation)
Int_t Fill(Double_t) override
Invalid Fill method.
Online http server for arbitrary ROOT application.
Bool_t RegisterCommand(const char *cmdname, const char *method, const char *icon=nullptr)
Register command which can be executed from web interface.
Bool_t Register(const char *subfolder, TObject *obj)
Register object in subfolder.
Bool_t SetItemField(const char *fullname, const char *name, const char *value)
Set item field in sniffer.
void Restrict(const char *path, const char *options)
Restrict access to specified object.
Random number generator class based on M.
virtual void Rannor(Float_t &a, Float_t &b)
Return 2 numbers distributed following a gaussian with mean=0 and sigma=1.
virtual Bool_t AccessPathName(const char *path, EAccessMode mode=kFileExists)
Returns FALSE if one can access a file using the specified access mode.
virtual Bool_t ProcessEvents()
Process pending events (GUI, timers, sockets).
- Author
- Sergey Linev
Definition in file httpaccess.C.