diff -crB --new-file Catalyst-Authentication-Store-DBIx-Class-0.1400/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm Catalyst-Authentication-Store-DBIx-Class-0.1400-new/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm *** Catalyst-Authentication-Store-DBIx-Class-0.1400/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm 2010-09-01 22:39:20.000000000 +0100 --- Catalyst-Authentication-Store-DBIx-Class-0.1400-new/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm 2010-11-17 14:32:51.000000000 +0000 *************** *** 190,196 **** return $self->load({ map { ($_ => $frozenuser->{$_}) } @{ $self->config->{id_field} } ! }); } return $self->load( { $self->config->{'id_field'} => $frozenuser }, $c); --- 190,196 ---- return $self->load({ map { ($_ => $frozenuser->{$_}) } @{ $self->config->{id_field} } ! }, $c); } return $self->load( { $self->config->{'id_field'} => $frozenuser }, $c); diff -crB --new-file Catalyst-Authentication-Store-DBIx-Class-0.1400/MANIFEST Catalyst-Authentication-Store-DBIx-Class-0.1400-new/MANIFEST *** Catalyst-Authentication-Store-DBIx-Class-0.1400/MANIFEST 2010-09-01 22:38:09.000000000 +0100 --- Catalyst-Authentication-Store-DBIx-Class-0.1400-new/MANIFEST 2010-11-17 14:37:49.000000000 +0000 *************** *** 29,34 **** --- 29,35 ---- t/08-simpledb-auth-roles-relationship.t t/09-simpledb-auth-roles-column.t t/10-user-autoload.t + t/11-authsessions-load-app-context.t t/lib/TestApp.pm t/lib/TestApp/Controller/Root.pm t/lib/TestApp/Model/TestApp.pm *************** *** 36,38 **** --- 37,41 ---- t/lib/TestApp/Schema/Role.pm t/lib/TestApp/Schema/User.pm t/lib/TestApp/Schema/UserRole.pm + t/lib/Catalyst/Authentication/Store/Person.pm + t/lib/Catalyst/Authentication/Store/Person/User.pm \ No newline at end of file diff -crB --new-file Catalyst-Authentication-Store-DBIx-Class-0.1400/t/11-authsessions-load-app-context.t Catalyst-Authentication-Store-DBIx-Class-0.1400-new/t/11-authsessions-load-app-context.t *** Catalyst-Authentication-Store-DBIx-Class-0.1400/t/11-authsessions-load-app-context.t 1970-01-01 01:00:00.000000000 +0100 --- Catalyst-Authentication-Store-DBIx-Class-0.1400-new/t/11-authsessions-load-app-context.t 2010-11-17 14:31:42.000000000 +0000 *************** *** 0 **** --- 1,79 ---- + #!perl + + use strict; + use warnings; + use DBI; + use File::Path; + use FindBin; + use Test::More; + use lib "$FindBin::Bin/lib"; + + BEGIN { + eval { require Test::WWW::Mechanize::Catalyst } + or plan skip_all => + "Test::WWW::Mechanize::Catalyst is required for this test"; + + eval { require DBD::SQLite } + or plan skip_all => + "DBD::SQLite is required for this test"; + + eval { require DBIx::Class } + or plan skip_all => + "DBIx::Class is required for this test"; + + eval { require Catalyst::Plugin::Session; + die unless $Catalyst::Plugin::Session::VERSION >= 0.02 } + or plan skip_all => + "Catalyst::Plugin::Session >= 0.02 is required for this test"; + + eval { require Catalyst::Plugin::Session::State::Cookie; } + or plan skip_all => + "Catalyst::Plugin::Session::State::Cookie is required for this test"; + + + plan tests => 4; + + $ENV{TESTAPP_CONFIG} = { + name => 'TestApp', + authentication => { + default_realm => "users", + realms => { + users => { + credential => { + 'class' => 'Password', + 'password_field' => 'password', + }, + store => { + 'class' => 'Person', + 'use_userdata_from_session' => 0, + }, + }, + }, + }, + }; + + $ENV{TESTAPP_PLUGINS} = [ + qw/Authentication + Session + Session::Store::Dummy + Session::State::Cookie + / + ]; + } + + use Test::WWW::Mechanize::Catalyst 'TestApp'; + my $m = Test::WWW::Mechanize::Catalyst->new; + + # log a user in + { + $m->get_ok( 'http://localhost/user_login?username=joeuser&password=hackme', undef, 'request ok' ); + $m->content_is( 'joeuser logged in', 'user logged in ok' ); + } + + # verify the user is still logged in + { + $m->get_ok( 'http://localhost/get_session_user', undef, 'request ok' ); + $m->content_is( 'joeuser', 'user still logged in' ); + } + + diff -crB --new-file Catalyst-Authentication-Store-DBIx-Class-0.1400/t/lib/Catalyst/Authentication/Store/Person/User.pm Catalyst-Authentication-Store-DBIx-Class-0.1400-new/t/lib/Catalyst/Authentication/Store/Person/User.pm *** Catalyst-Authentication-Store-DBIx-Class-0.1400/t/lib/Catalyst/Authentication/Store/Person/User.pm 1970-01-01 01:00:00.000000000 +0100 --- Catalyst-Authentication-Store-DBIx-Class-0.1400-new/t/lib/Catalyst/Authentication/Store/Person/User.pm 2010-11-17 14:26:04.000000000 +0000 *************** *** 0 **** --- 1,25 ---- + package Catalyst::Authentication::Store::Person::User; + + use strict; + use warnings; + use base qw/Catalyst::Authentication::Store::DBIx::Class::User/; + use base qw/Class::Accessor::Fast/; + use Data::Dump; + + sub load { + my ($self, $authinfo, $c) = @_; + if ( exists( $authinfo->{'id'} ) ) { + $self->_user( $c->model('TestApp::User')->find($authinfo->{'id'}) ); + } elsif ( exists( $authinfo->{'username'} ) ) { + my $u = $c->model('TestApp::User')->find({ username => $authinfo->{'username'} }); + $self->_user( $u ); + } + if ($self->get_object) { + return $self; + } else { + return undef; + } + } + + 1; + __END__ \ No newline at end of file diff -crB --new-file Catalyst-Authentication-Store-DBIx-Class-0.1400/t/lib/Catalyst/Authentication/Store/Person.pm Catalyst-Authentication-Store-DBIx-Class-0.1400-new/t/lib/Catalyst/Authentication/Store/Person.pm *** Catalyst-Authentication-Store-DBIx-Class-0.1400/t/lib/Catalyst/Authentication/Store/Person.pm 1970-01-01 01:00:00.000000000 +0100 --- Catalyst-Authentication-Store-DBIx-Class-0.1400-new/t/lib/Catalyst/Authentication/Store/Person.pm 2010-11-04 01:23:42.000000000 +0000 *************** *** 0 **** --- 1,21 ---- + package Catalyst::Authentication::Store::Person; + + use strict; + use warnings; + use base qw/Catalyst::Authentication::Store::DBIx::Class/; + + our $VERSION= "0.01"; + + sub new { + my ( $class, $config, $app ) = @_; + $config->{user_class} = 'TestApp::User'; + $config->{store_user_class} = 'Catalyst::Authentication::Store::Person::User'; + $config->{role_relation} = 'role'; + $config->{role_field} = 'role'; + + return $class->SUPER::new( $config, $app ); + } + + __PACKAGE__; + + __END__ \ No newline at end of file