[Catalyst-commits] r7409 - in trunk/Catalyst-Plugin-Authentication: lib/Catalyst/Authentication/Credential lib/Catalyst/Authentication/Store lib/Catalyst/Plugin t/lib

jayk at dev.catalyst.perl.org jayk at dev.catalyst.perl.org
Thu Jan 24 20:55:40 GMT 2008


Author: jayk
Date: 2008-01-24 20:55:39 +0000 (Thu, 24 Jan 2008)
New Revision: 7409

Modified:
   trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Credential/Password.pm
   trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Store/Minimal.pm
   trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Store/Null.pm
   trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication.pm
   trunk/Catalyst-Plugin-Authentication/t/lib/AuthSessionTestApp.pm
   trunk/Catalyst-Plugin-Authentication/t/lib/AuthTestApp.pm
Log:
Update to correct behavior when using the new 'Plugin::Authentication' 
configuration naming scheme.

Modified: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Credential/Password.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Credential/Password.pm	2008-01-24 20:44:18 UTC (rev 7408)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Credential/Password.pm	2008-01-24 20:55:39 UTC (rev 7409)
@@ -236,7 +236,7 @@
 =head1 CONFIGURATION
 
     # example
-    __PACKAGE__->config->{authentication} = 
+    __PACKAGE__->config->{'Plugin::Authentication'} = 
                 {  
                     default_realm => 'members',
                     realms => {

Modified: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Store/Minimal.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Store/Minimal.pm	2008-01-24 20:44:18 UTC (rev 7408)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Store/Minimal.pm	2008-01-24 20:55:39 UTC (rev 7409)
@@ -79,7 +79,7 @@
 
     $c->default_auth_store(
         __PACKAGE__->new( 
-            $c->config->{authentication}, $c
+            $c->config->{'Plugin::Authentication'}, $c
         )
     );
 
@@ -107,7 +107,7 @@
         Authentication
     /;
 
-    __PACKAGE__->config->{authentication} = 
+    __PACKAGE__->config->{'Plugin::Authentication'} = 
                     {  
                         default_realm => 'members',
                         realms => {

Modified: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Store/Null.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Store/Null.pm	2008-01-24 20:44:18 UTC (rev 7408)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Authentication/Store/Null.pm	2008-01-24 20:55:39 UTC (rev 7409)
@@ -52,7 +52,7 @@
         Authentication
     );
 
-    __PACKAGE__->config->{authentication} = {
+    __PACKAGE__->config->{'Plugin::Authentication'} = {
         default_realm => 'remote',
         realms => {
             remote => {

Modified: trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication.pm	2008-01-24 20:44:18 UTC (rev 7408)
+++ trunk/Catalyst-Plugin-Authentication/lib/Catalyst/Plugin/Authentication.pm	2008-01-24 20:55:39 UTC (rev 7409)
@@ -20,7 +20,7 @@
 #	constant->import(have_want => eval { require Want });
 #}
 
-our $VERSION = "0.10004";
+our $VERSION = "0.10005";
 
 sub set_authenticated {
     my ( $c, $user, $realmname ) = @_;
@@ -39,7 +39,7 @@
     }
     
     if (    $c->isa("Catalyst::Plugin::Session")
-        and $c->config->{authentication}{use_session}
+        and $c->config->{'Plugin::Authentication'}{'use_session'}
         and $user->supports("session") )
     {
         $realm->save_user_in_session($c, $user);
@@ -107,7 +107,7 @@
 
     if (
         $c->isa("Catalyst::Plugin::Session")
-        and $c->config->{authentication}{use_session}
+        and $c->config->{'Plugin::Authentication'}{'use_session'}
         and $c->session_is_valid
     ) {
         delete @{ $c->session }{qw/__user __user_realm/};
@@ -135,7 +135,7 @@
 
     return unless
         $c->isa("Catalyst::Plugin::Session")
-        and $c->config->{authentication}{use_session}
+        and $c->config->{'Plugin::Authentication'}{'use_session'}
         and $c->session_is_valid;
 
     return $c->session->{__user};
@@ -179,9 +179,21 @@
     ## make classdata where it is used.  
     $app->mk_classdata( '_auth_realms' => {});
     
-    my $cfg = $app->config->{'Plugin::Authentication'} ||= $app->config->{'authentication'} ||= {};
+    my $cfg = $app->config->{'Plugin::Authentication'};
+    if (!defined($cfg)) {
+        if (exists($app->config->{'authentication'})) {
+            $cfg = $app->config->{'authentication'};
+            $app->config->{'Plugin::Authentication'} = $app->config->{'authentication'};
+        } else {
+            $cfg = {};
+        }
+    }
 
-    $cfg->{use_session} = 1;
+    # old default was to force use_session on.  This must remain for that
+    # reason - but if use_session is already in the config, we respect it's setting.
+    if (!exists($cfg->{'use_session'})) {
+        $cfg->{'use_session'} = 1;
+    }
     
     if (exists($cfg->{'realms'})) {
         foreach my $realm (keys %{$cfg->{'realms'}}) {
@@ -514,7 +526,7 @@
         Authentication
     /;
 
-    __PACKAGE__->config->{authentication} = 
+    __PACKAGE__->config->{'Plugin::Authentication'} = 
                 {  
                     default_realm => 'members',
                     realms => {
@@ -636,7 +648,7 @@
 You can accomplish this simply by installing the DBIx::Class Store and
 changing your config:
 
-    __PACKAGE__->config->{authentication} = 
+    __PACKAGE__->config->{'Plugin::Authentication'} = 
                     {  
                         default_realm => 'members',
                         realms => {
@@ -662,7 +674,7 @@
 =head1 CONFIGURATION
 
     # example
-    __PACKAGE__->config->{authentication} = 
+    __PACKAGE__->config->{'Plugin::Authentication'} = 
                 {  
                     default_realm => 'members',
                     realms => {
@@ -887,7 +899,7 @@
 
 Return the store whose name is 'default'.
 
-This is set to C<< $c->config->{authentication}{store} >> if that value exists,
+This is set to C<< $c->config->{'Plugin::Authentication'}{store} >> if that value exists,
 or by using a Store plugin:
 
     # load the Minimal authentication store.

Modified: trunk/Catalyst-Plugin-Authentication/t/lib/AuthSessionTestApp.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication/t/lib/AuthSessionTestApp.pm	2008-01-24 20:44:18 UTC (rev 7408)
+++ trunk/Catalyst-Plugin-Authentication/t/lib/AuthSessionTestApp.pm	2008-01-24 20:55:39 UTC (rev 7409)
@@ -68,7 +68,7 @@
     ok( !$c->user, "no user object either" );
 }
 
-__PACKAGE__->config->{authentication}{users} = $users = {
+__PACKAGE__->config->{'Plugin::Authentication'}{users} = $users = {
 	foo => User::SessionRestoring->new(
 		id => 'foo',
 		password => "s3cr3t",

Modified: trunk/Catalyst-Plugin-Authentication/t/lib/AuthTestApp.pm
===================================================================
--- trunk/Catalyst-Plugin-Authentication/t/lib/AuthTestApp.pm	2008-01-24 20:44:18 UTC (rev 7408)
+++ trunk/Catalyst-Plugin-Authentication/t/lib/AuthTestApp.pm	2008-01-24 20:55:39 UTC (rev 7409)
@@ -52,7 +52,7 @@
 	$c->res->body( "ok" );
 }
 
-__PACKAGE__->config->{authentication}{users} = $users = {
+__PACKAGE__->config->{'Plugin::Authentication'}{users} = $users = {
 	foo => {
 		password => "s3cr3t",
 	},




More information about the Catalyst-commits mailing list