Skip to content
stefano casazza edited this page Jan 18, 2019 · 4 revisions

The http plugin implements URI masking with basic (SSL only) and digest authentication. In simple terms if a URI request matches a Protected regex mask UServer will send an authentication challenge.

Configuration

URI masks can be used for both individual resources or paths, for example a digest system with two user levels students and staff:

http {
    DIGEST_AUTHENTICATION yes
    URI_PROTECTED_MASK  /staff/*|/students/*
    # URI_PROTECTED_ALLOWED_IP   list of comma separated client address for IP-based access control (IPADDR[/MASK])
}

In order for a user to be authenticated they must respond with a username and password matching those stored in staff.htpasswd for (userver_ssl) basic authentication or staff.htdigest for (userver_tcp) digest authentication.

$DOCUMENT_ROOT/../staff.htdigest
$DOCUMENT_ROOT/../students.htdigest

The files can be generated with htpasswd and htdigest respectively. Note that the realm is Hard Coded to 'Protected Area' therefore the htdigest command will be :

htdigest -c staff.htdigest 'Protected Area' admin  

If you are using basic or digest authentication one can retrieve the logged in user using UHTTP::getUserAuthentication() and augment a users credentials using the functions below:

UHTTP::getPasswdDB
UHTTP::setPasswdUser
UHTTP::revokePasswdUser
UHTTP::savePasswdDB
Clone this wiki locally