# This file is part of vmod-basicauth # Copyright (C) 2013-2016 Sergey Poznyakoff # # Vmod-basicauth is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) # any later version. # # Vmod-basicauth is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with vmod-basicauth. If not, see . $Module basicauth 3 Basic HTTP authentication COLOPHON ======== This document provides a short description of the **vmod-basicauth** module. For a detailed documentation, please see the vmod-basicauth(3) manual page. DESCRIPTION =========== The **vmod-basicauth** module implements basic HTTP authentication against the password file created using the **htpasswd** command. Four kinds of password hashes are supported: Apache MD5, crypt, SHA1, and plaintext. $Function BOOL match(PRIV_TASK, STRING, STRING) Description The **match** function returns **TRUE** or **FALSE** depending on whether the authentication succeeds or not. The *passfile* argument supplies the name of the password file to use. The *authstr* argument is the authentication string (normally, the value of the Authorization HTTP header). Example :: if (!basicauth.match("/var/www/.htpasswd", req.http.Authorization)) { return(synth(401, "Restricted")); } SEE ALSO ======== * vcl(7) * varnishd(1)