[Catalyst-commits] r13004 - in trunk/Catalyst-Authentication-Store-DBIx-Class: . lib/Catalyst/Authentication/Store/DBIx lib/Catalyst/Authentication/Store/DBIx/Class t t/lib

jayk at dev.catalyst.perl.org jayk at dev.catalyst.perl.org
Thu Mar 4 02:16:46 GMT 2010


Author: jayk
Date: 2010-03-04 02:16:46 +0000 (Thu, 04 Mar 2010)
New Revision: 13004

Modified:
   trunk/Catalyst-Authentication-Store-DBIx-Class/Changes
   trunk/Catalyst-Authentication-Store-DBIx-Class/Makefile.PL
   trunk/Catalyst-Authentication-Store-DBIx-Class/lib/Catalyst/Authentication/Store/DBIx/Class.pm
   trunk/Catalyst-Authentication-Store-DBIx-Class/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm
   trunk/Catalyst-Authentication-Store-DBIx-Class/t/00-load.t
   trunk/Catalyst-Authentication-Store-DBIx-Class/t/03-authtest.t
   trunk/Catalyst-Authentication-Store-DBIx-Class/t/08-simpledb-auth-roles-relationship.t
   trunk/Catalyst-Authentication-Store-DBIx-Class/t/09-simpledb-auth-roles-column.t
   trunk/Catalyst-Authentication-Store-DBIx-Class/t/lib/TestApp.pm
Log:
Committed missed changes from 0.1082 
Changed messaging when user provides no fields in authenticate that match up with user table 


Modified: trunk/Catalyst-Authentication-Store-DBIx-Class/Changes
===================================================================
--- trunk/Catalyst-Authentication-Store-DBIx-Class/Changes	2010-03-03 23:13:15 UTC (rev 13003)
+++ trunk/Catalyst-Authentication-Store-DBIx-Class/Changes	2010-03-04 02:16:46 UTC (rev 13004)
@@ -1,5 +1,10 @@
 Revision history for Catalyst-Plugin-Authentication-Store-DBIx-Class
 
+0.1083  2010-03-03
+        Tweaking exception message to better explain what people did wrong when 
+            they pass bad columns to authenticate.
+
+0.1082  2008-10-27
         Documentation tweak to clarify user_class, store_user_class etc.
 
 0.108   2008-09-25

Modified: trunk/Catalyst-Authentication-Store-DBIx-Class/Makefile.PL
===================================================================
--- trunk/Catalyst-Authentication-Store-DBIx-Class/Makefile.PL	2010-03-03 23:13:15 UTC (rev 13003)
+++ trunk/Catalyst-Authentication-Store-DBIx-Class/Makefile.PL	2010-03-04 02:16:46 UTC (rev 13004)
@@ -41,7 +41,7 @@
 test_requires 'Test::More';
 
 auto_install;
-resources repository => 'http://dev.catalyst.perl.org/repos/Catalyst/trunk/Catalyst-Authentication-Store-DBIx-Class/';
+resources repository => 'http://dev.catalystframework.org/repos/Catalyst/trunk/Catalyst-Authentication-Store-DBIx-Class';
 
 WriteAll;
 

Modified: trunk/Catalyst-Authentication-Store-DBIx-Class/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm
===================================================================
--- trunk/Catalyst-Authentication-Store-DBIx-Class/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm	2010-03-03 23:13:15 UTC (rev 13003)
+++ trunk/Catalyst-Authentication-Store-DBIx-Class/lib/Catalyst/Authentication/Store/DBIx/Class/User.pm	2010-03-04 02:16:46 UTC (rev 13004)
@@ -93,7 +93,7 @@
         if (keys %{$searchargs}) {
             $self->_user($self->resultset->search($searchargs)->first);
         } else {
-            Catalyst::Exception->throw("User retrieval failed: no columns from " . $self->config->{'user_model'} . " were provided");
+            Catalyst::Exception->throw("Failed to load user data.  You passed [" . join(',', keys %{$authinfo}) . "] to authenticate() but your user source (" .  $self->config->{'user_model'} . ") only has these columns: [" . join( ",", $self->resultset->result_source->columns ) . "]   Check your authenticate() call.");
         }
     }
 

Modified: trunk/Catalyst-Authentication-Store-DBIx-Class/lib/Catalyst/Authentication/Store/DBIx/Class.pm
===================================================================
--- trunk/Catalyst-Authentication-Store-DBIx-Class/lib/Catalyst/Authentication/Store/DBIx/Class.pm	2010-03-03 23:13:15 UTC (rev 13003)
+++ trunk/Catalyst-Authentication-Store-DBIx-Class/lib/Catalyst/Authentication/Store/DBIx/Class.pm	2010-03-04 02:16:46 UTC (rev 13004)
@@ -4,7 +4,7 @@
 use warnings;
 use base qw/Class::Accessor::Fast/;
 
-our $VERSION= "0.1081";
+our $VERSION= "0.1083";
 
 
 BEGIN {

Modified: trunk/Catalyst-Authentication-Store-DBIx-Class/t/00-load.t
===================================================================
--- trunk/Catalyst-Authentication-Store-DBIx-Class/t/00-load.t	2010-03-03 23:13:15 UTC (rev 13003)
+++ trunk/Catalyst-Authentication-Store-DBIx-Class/t/00-load.t	2010-03-04 02:16:46 UTC (rev 13004)
@@ -1,4 +1,4 @@
-#!perl -T
+#!perl 
 
 use Test::More tests => 1;
 

Modified: trunk/Catalyst-Authentication-Store-DBIx-Class/t/03-authtest.t
===================================================================
--- trunk/Catalyst-Authentication-Store-DBIx-Class/t/03-authtest.t	2010-03-03 23:13:15 UTC (rev 13003)
+++ trunk/Catalyst-Authentication-Store-DBIx-Class/t/03-authtest.t	2010-03-04 02:16:46 UTC (rev 13004)
@@ -17,7 +17,7 @@
         or plan skip_all =>
         "DBIx::Class is required for this test";
 
-    plan tests => 15;
+    plan tests => 17;
 
     $ENV{TESTAPP_DB_FILE} = "$FindBin::Bin/auth.db" unless exists($ENV{TESTAPP_DB_FILE});
 
@@ -93,14 +93,22 @@
     is( $res->content, 'jayk logged in', 'resultset based login ok' );
 }
 
+# invalid user
 {
+    ok( my $res = request('http://localhost/bad_login?username=foo&password=bar'), 'request ok' );
+    like( $res->content, qr/only has these columns/, 'incorrect parameters to authenticate throws a useful exception' );
+}
+
+
+{
     $ENV{TESTAPP_CONFIG}->{authentication}->{realms}->{users}->{store}->{user_model} = 'Nonexistent::Class';
     my $res = request('http://localhost/user_login?username=joeuser&password=hackme');
     like( $res->content, qr/\$\Qc->model('Nonexistent::Class') did not return a resultset. Did you set user_model correctly?/, 'test for wrong user_class' );
 }
 	    
-	    
+	  
 
 
+
 # clean up
 unlink $ENV{TESTAPP_DB_FILE};

Modified: trunk/Catalyst-Authentication-Store-DBIx-Class/t/08-simpledb-auth-roles-relationship.t
===================================================================
--- trunk/Catalyst-Authentication-Store-DBIx-Class/t/08-simpledb-auth-roles-relationship.t	2010-03-03 23:13:15 UTC (rev 13003)
+++ trunk/Catalyst-Authentication-Store-DBIx-Class/t/08-simpledb-auth-roles-relationship.t	2010-03-04 02:16:46 UTC (rev 13004)
@@ -32,6 +32,7 @@
             default => {
 				class => 'SimpleDB',
                 user_model => 'TestApp::User',
+                password_type => 'clear'
 			}
 		}
     };

Modified: trunk/Catalyst-Authentication-Store-DBIx-Class/t/09-simpledb-auth-roles-column.t
===================================================================
--- trunk/Catalyst-Authentication-Store-DBIx-Class/t/09-simpledb-auth-roles-column.t	2010-03-03 23:13:15 UTC (rev 13003)
+++ trunk/Catalyst-Authentication-Store-DBIx-Class/t/09-simpledb-auth-roles-column.t	2010-03-04 02:16:46 UTC (rev 13004)
@@ -32,7 +32,8 @@
             default => {
 				class => 'SimpleDB',
 				user_model => 'TestApp::User',
-				role_column => 'role_text'
+				role_column => 'role_text',
+				password_type => 'clear'
 			}
 		}
         

Modified: trunk/Catalyst-Authentication-Store-DBIx-Class/t/lib/TestApp.pm
===================================================================
--- trunk/Catalyst-Authentication-Store-DBIx-Class/t/lib/TestApp.pm	2010-03-03 23:13:15 UTC (rev 13003)
+++ trunk/Catalyst-Authentication-Store-DBIx-Class/t/lib/TestApp.pm	2010-03-04 02:16:46 UTC (rev 13004)
@@ -105,6 +105,30 @@
     }
 }
 
+sub bad_login : Global {
+    my ( $self, $c ) = @_;
+
+    ## this allows anyone to login regardless of status.
+    eval {
+        $c->authenticate({ william => $c->request->params->{'username'},
+                           the_bum => $c->request->params->{'password'}
+                         });
+        1;
+    } or do {
+        return $c->res->body($@);
+    };
+
+    if ( $c->user_exists ) {
+        if ( $c->req->params->{detach} ) {
+            $c->detach( $c->req->params->{detach} );
+        }
+        $c->res->body( $c->user->get('username') . ' logged in' );
+    }
+    else {
+        $c->res->body( 'not logged in' );
+    }
+}
+
 ## need to add a resultset login test and a search args login test
 
 sub user_logout : Global {




More information about the Catalyst-commits mailing list