The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

Name

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

Version

Describes v0.16.$Rev: 1 $

Synopsis

   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

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

Configuration and Environment

Defined the following attributes

config

The constructor stores a copy of the config on itself

Subroutines/Methods

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::UsersUnix 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

None

Dependencies

CatalystX::Usul::Moose

Incompatibilities

There are no known incompatibilities in this module

Bugs and Limitations

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

Author

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

License and Copyright

Copyright (c) 2014 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