CatalystX::Usul::Authentication - Use a Catalyst model as an authentication store
0.6.$Revision: 1165 $
package MyApp; use Catalyst qw( ... Authentication ... ); # The Catalyst::Authentication config below uses this module as an # authentication store for both realms <component name="Plugin::Authentication"> <default_realm>R01-Localhost</default_realm> <realms> <R01-Localhost> <credential> <class>Password</class> <password_field>password</password_field> <password_type>self_check</password_type> </credential> <store> <class>+CatalystX::Usul::Authentication</class> <model_class>IdentityUnix</model_class> <user_field>username</user_field> </store> </R01-Localhost> <R02-Database> <credential> <class>Password</class> <password_field>password</password_field> <password_type>self_check</password_type> </credential> <store> <class>+CatalystX::Usul::Authentication</class> <model_class>IdentityDBIC</model_class> <user_field>username</user_field> </store> </R02-Database> </realms> </component>
Implements the Catalyst::Authentication::Store interface. Uses any Catalyst::Model that implements the methods; find_user, check_password, for_session, get, get_object, id, and supports
find_user
check_password
for_session
get
get_object
id
supports
Constructor options are passed as a list of scalars. Options are:
The constructor stores a copy of the $config on itself
Uses the model method to obtain a copy of the identity object. This identity object is instantiated by Catalyst when the application restarts. In the example config the R01-Localhost authentication realm uses MyApp::Model::IdentityUnix as an identity class (the MyApp::Model:: prefix is automatically applied to the store class value). The identity object's find_user method returns a user object. The config for the authentication store defines the user field in the input parameters.
MyApp::Model::IdentityUnix
MyApp::Model::
Exposes the for_session method in the user class. This allows the user class to remove attribute from the user object prior to serialisation on the session store
Return the user object if it already exists otherwise create one by calling our own find_user method
Expose the supports class method in the user class. Allows the user class to define which optional features it supports
None
There are no known incompatibilities in this module
There are no known bugs in this module. Please report problems to the address below. Patches are welcome
Peter Flanigan, <Support at RoxSoft.co.uk>
<Support at RoxSoft.co.uk>
Copyright (c) 2008 Peter Flanigan. All rights reserved
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic
This program is distributed in the hope that it will be useful, but WITHOUT WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE
To install CatalystX::Usul, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CatalystX::Usul
CPAN shell
perl -MCPAN -e shell install CatalystX::Usul
For more information on module installation, please visit the detailed CPAN module installation guide.