Apache::Htpasswd is a Perl module that allows you to manage Unix crypt-style password file.
SYNOPSIS
use Apache::Htpasswd;
$foo = new Apache::Htpasswd("path-to-file");
$foo = new Apache::Htpasswd({passwdFile => "path-to-file",
ReadOnly => 1}
);
# Add an entry
$foo->htpasswd("zog", "password");
# Change a password
$foo->htpasswd("zog", "new-password", "old-password");
# Change a password without checking against old password
$foo->htpasswd("zog", "new-password", {'overwrite' => 1});
# Check that a password is correct
$foo->htCheckPassword("zog", "password");
# Fetch an encrypted password
$foo->fetchPass("foo");
# Delete entry
$foo->htDelete("foo");
# If something fails, check error
$foo->error;
# Write in the extra info field
$foo->writeInfo("login", "info");
# Get extra info field for a user
$foo->fetchInfo("login");
This module comes with a set of methods to use with htaccess password files. These files (and htaccess) are used to do Basic Authentication on a web server.
The passwords file is a flat-file with login name and their associated crypted password. You can use this for non-Apache files if you wish, but it was written specifically for .htaccess style files.
Product's homepage
Requirements:
· Perl