To configure a .htpasswd-formatted file for authentication, do $AuthUser['htpasswd'] = '/path/to/.htpasswd'; prior to including this script. Individual username/password combinations can also be placed directly in the $AuthUser array, such as: $AuthUser['pmichaud'] = crypt('secret'); To authenticate against an LDAP server, put the url for the server in $AuthUser['ldap'], as in: $AuthUser['ldap'] = 'ldap://ldap.example.com/ou=People,o=example?uid'; */ # let Site.AuthForm know that we're doing user-based authorization $EnableAuthUser = 1; if (@$_POST['authid']) { AuthUserId($pagename, stripmagic(@$_POST['authid']), stripmagic(@$_POST['authpw'])); } else { SessionAuth($pagename); } function AuthUserId($pagename, $id, $pw = NULL) { global $AuthUser, $AuthUserPageFmt, $AuthUserFunctions, $AuthId, $MessagesFmt; foreach ((array) $AuthUser as $k => $v) { $auth[$k] = (array) $v; } $authid = ''; # load information from Site.AuthUser (or page in $AuthUserPageFmt) SDV($AuthUserPageFmt, '$SiteGroup.AuthUser'); SDVA($AuthUserFunctions, array('htpasswd' => 'AuthUserHtPasswd', 'ldap' => 'AuthUserLDAP', $id => 'AuthUserConfig')); $pn = FmtPageName($AuthUserPageFmt, $pagename); $apage = ReadPage($pn, READPAGE_CURRENT);
To configure a .htpasswd-formatted file for authentication, do $AuthUser['htpasswd'] = '/path/to/.htpasswd'; prior to including this script. Individual username/password combinations can also be placed directly in the $AuthUser array, such as: $AuthUser['pmichaud'] = crypt('secret'); To authenticate against an LDAP server, put the url for the server in $AuthUser['ldap'], as in: $AuthUser['ldap'] = 'ldap://ldap.example.com/ou=People,o=example?uid'; */ # let Site.AuthForm know that we're doing user-based authorization $EnableAuthUser = 1; if (@$_POST['authid']) { AuthUserId($pagename, @$_POST['authid'], @$_POST['authpw']); } else { SessionAuth($pagename); } function AuthUserId($pagename, $id, $pw = NULL) { global $AuthUser, $AuthUserPageFmt, $AuthUserFunctions, $AuthId, $MessagesFmt; $auth = $AuthUser; $authid = ''; # load information from Site.AuthUser (or page in $AuthUserPageFmt) SDV($AuthUserPageFmt, '$SiteGroup.AuthUser'); SDVA($AuthUserFunctions, array('htpasswd' => 'AuthUserHtPasswd', 'ldap' => 'AuthUserLDAP', $id => 'AuthUserConfig')); $pn = FmtPageName($AuthUserPageFmt, $pagename); $apage = ReadPage($pn, READPAGE_CURRENT); if ($apage && preg_match_all("/^\\s*([@\\w][^\\s:]*):(.*)/m", $apage['text'], $matches, PREG_SET_ORDER)) { foreach ($matches as $m) {