CatalystX::Usul::Authentication - Use a Catalyst model as an authentication store


CatalystX-Usul documentation  | view source Contained in the CatalystX-Usul distribution.

Index


Name

Top

CatalystX::Usul::Authentication - Use a Catalyst model as an authentication store

Version

Top

0.3.$Revision: 576 $

Synopsis

Top

   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>

Description

Top

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

Subroutines/Methods

Top

new

Constructor options are passed as a list of scalars. Options are:

$config

The constructor stores a copy of the $config on itself

find_user

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.

for_session

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

from_session

Return the user object if it already exists otherwise create one by calling our own find_user method

user_supports

Expose the supports class method in the user class. Allows the user class to define which optional features it supports

Diagnostics

Top

None

Configuration and Environment

Top

None

Dependencies

Top

Class::Accessor::Fast

Incompatibilities

Top

There are no known incompatibilities in this module

Bugs and Limitations

Top

There are no known bugs in this module. Please report problems to the address below. Patches are welcome

Author

Top

Peter Flanigan, <Support at RoxSoft.co.uk>

License and Copyright

Top


CatalystX-Usul documentation  | view source Contained in the CatalystX-Usul distribution.