1 package Catalyst::Plugin::Authentication::Store::DBIx::Class::Backend;
5 use base qw/Class::Accessor::Fast/;
8 my ( $class, $config, $app ) = @_;
10 ## figure out if we are overriding the default store user class.
11 my $storeclass = $config->{'store_user_class'} || "Catalyst::Plugin::Authentication::Store::DBIx::Class::User";
13 ## fields can be specified to be ignored during user location. This allows
14 ## authinfo to contain the user info required to find the user, as well as the password
15 ## to try to match to, for example. It can be added to by setting ignore_fields in the
16 ## authinfo hashref also.
17 $config->{'ignore_fields_in_find'} ||= [ 'password' ];
18 push @{$config->{'ignore_fields_in_find'}}, ('searchargs', 'ignore_fields');
20 ## make sure the store class is loaded.
21 Catalyst::Utils::ensure_class_loaded( $storeclass );
24 $self->{config} = $config;
25 $self->{store_user_class} = $storeclass;
27 #$self->{role_relation} ||= 'roles';
28 #$self->{role_field} ||= 'role';
34 my ( $self, $c, $frozenuser ) = @_;
36 return $frozenuser if ref $frozenuser;
38 # this could be a lot better. But for now it just assumes $frozenuser is an id and uses find_user
39 # XXX: hits the database on every request? Not good...
40 return $self->find_user( { id => $frozenuser }, $c);
44 my ($self, $c, $user) = @_;
46 return $user->for_session($c);
50 my ( $self, $authinfo, $c ) = @_;
52 return $self->{'store_user_class'}->new($authinfo, $self->{config}, $c);
57 # this can work as a class method
58 shift->{'store_user_class'}->supports( @_ );
67 Catalyst::Plugin::Authentication::Store::DBIx::Class::Backend - A class to ...
71 This documentation refers to version 0.01.
75 use Catalyst::Plugin::Authentication::Store::DBIx::Class::Backend;
79 The Catalyst::Plugin::Authentication::Store::DBIx::Class::Backend class implements ...
81 =head1 SUBROUTINES / METHODS
83 =head2 new (constructor)
90 Insert description of constructor here...
92 =head2 from_session (method)
98 Insert description of method here...
100 =head2 for_session (method)
106 Insert description of method here...
108 =head2 find_user (method)
114 Insert description of method here...
121 Insert description of subroutine here...
125 Modules used, version dependencies, core yes/no
135 =head1 BUGS AND LIMITATIONS
137 None known currently, please email the author if you find any.
141 L<Catalyst::Plugin::Authentication::Store::DBIC>, L<Catalyst::Plugin::Authentication>,
142 L<Catalyst::Plugin::Authorization::Roles>
146 Jason Kuri (jk@domain.tld)
150 Copyright 2006 by Jason Kuri.
152 This software is free. It is licensed under the same terms as Perl itself.