[Catalyst] Catalyst::Plugin::Authentication::Simple 1.0 on the CPAN

Mark Ethan Trostler mark at zzo.com
Wed Jul 27 02:16:21 CEST 2005


All rejoice 1.0 of C::P::Auth::Simple is on the CPAN.
There is a remarkable similarity between this & the other two C::P::Auth
modules already on the CPAN, go figure.
  Mark

>From the README:

Catalyst-Plugin-Authentication-Simple version 1.0
=================================================

A 'simple' authentication mechanism for Catalyst.
Usernames, passwords, & roles come from either a file or an array ref.

In your Catalyst main module say something like:

MyCatalystObject->config(
        ....
        authentication => {
            user_file => '/full/path/to/user/file',
            [ password_hash => 'md5' OR 'sha' ]
        },


The format of 'user_file' is:

<user1>:<pass1>:<role1>,<role2>,<role3>
<user2>:<pass2>:<role2>,<role4>
<user3>:<pass3>:<role1>,<role3>,<role4>
...

Instead of 'user_file' you can pass in an array ref like:

        authentication => {
            users => [
                        '<user1>:<pass1>:<role1>,<role2>,<role3>',
                        '<user2>:<pass2>:<role2>,<role4>',
                        '<user3>:<pass3>:<role1>,<role3>,<role4>.
                    ],
            [ password_hash => 'md5' OR 'sha' ]


IF 'password_hash' is set to md5 or sha the password is a hash of one of
those two variants, so the $password you pass into 'login' or
'session_login' will be hashed by Digest::MD5::md5_hex or
Digest::SHA::sha1_hex & then checked for equality.

Final thing - if you pass in a filename the username list will be read in
once & only once & then converted to the 'users' array ref.  Later in your
app you can dynamically change this array ref. as you please for future
login attempts...

Have Fun!





More information about the Catalyst mailing list