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");
if (cnt++ % kUPDATE == 0) {
}
}
}
- Author
Definition in file httpaccess.C.