Apache2::Authen::Passphrase - basic authentication with Authen::Passphrase
use Apache2::Authen::Passphrase qw/pwcheck pwset pwhash/; $Apache2::Authen::Passphrase::rootdir = "/path/to/user/directory" my $hash = pwhash $username, $password; pwset $username, "pass123"; eval { pwcheck $username, "pass123" }; # In Apache2 config <Location /secret> PerlAuthenHandler Apache2::Authen::Passphrase PerlSetVar AuthenPassphraseRootdir /path/to/user/directory AuthName MyAuth Require valid-user </Location>
Apache2::Authen::Passphrase is a perl module which provides easy-to-use Apache2 authentication. It exports some utility functions and it contains a PerlAuthenHandler.
Takes the password as a single argument and returns the password hash.
Sets the password of $username to $password.
Checks the given username and password, throwing an exception if the username is invalid or the password is incorrect.
The PerlAuthenHandler for use in apache2. It uses Basic Access Authentication.
A regex that matches valid usernames. Usernames must be at least 2 characters, at most 20 characters, and they may only contain word characters ([A-Za-z0-9_]).
[A-Za-z0-9_]
Exception thrown if the username does not match USER_REGEX.
USER_REGEX
Exception thrown if the password is different from the one stored in the user's yml file.
The version of the passphrase. It is incremented each time the passphrase hashing scheme is changed. Versions so far:
Uses Authen::Passphrase::BlowfishCrypt with a cost factor of 10
Authen::Passphrase::BlowfishCrypt
Marius Gavrilescu, <marius@ieval.ro>
Copyright (C) 2013 by Marius Gavrilescu
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.14.2 or, at your option, any later version of Perl 5 you may have available.
To install Apache2::Authen::Passphrase, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Apache2::Authen::Passphrase
CPAN shell
perl -MCPAN -e shell install Apache2::Authen::Passphrase
For more information on module installation, please visit the detailed CPAN module installation guide.