Check for session method, not ISA C::P::Session for auth collaberation. evdb++
Tomas Doran [Wed, 4 Mar 2009 12:53:25 +0000 (12:53 +0000)]
Changes
lib/Catalyst/Authentication/Realm.pm
lib/Catalyst/Plugin/Authentication.pm

diff --git a/Changes b/Changes
index b15109c..9bf25ec 100644 (file)
--- a/Changes
+++ b/Changes
@@ -3,6 +3,8 @@ Revision history for Perl extension Catalyst::Plugin::Authentication
 0.10011 *UNRELEASED*
       - Update t/live_app_session.t to skip unless you have a newer, more
         reliable version of TWMC (RT#43817)
+      - Change check for isa Catalyst::Plugin::Session to just check the
+        existance of a session method. (Edmund von der Burg)
 
 0.10010
       - Change from NEXT to MRO::Compat
index b36d14d..5c31034 100644 (file)
@@ -171,7 +171,7 @@ sub user_is_restorable {
     my ($self, $c) = @_;
     
     return unless
-         $c->isa("Catalyst::Plugin::Session")
+         $c->can('session')
          and $self->config->{'use_session'}
          and $c->session_is_valid;
 
@@ -214,7 +214,7 @@ sub persist_user {
     my ($self, $c, $user) = @_;
     
     if (
-        $c->isa("Catalyst::Plugin::Session")
+        $c->can('session')
         and $self->config->{'use_session'}
         and $user->supports("session") 
     ) {
@@ -236,7 +236,7 @@ sub remove_persisted_user {
     my ($self, $c) = @_;
     
     if (
-        $c->isa("Catalyst::Plugin::Session")
+        $c->can('session')
         and $self->config->{'use_session'}
         and $c->session_is_valid
     ) {
index 223119f..4627b22 100644 (file)
@@ -98,7 +98,7 @@ sub persist_user {
         ## if we have a valid session handler - we store the 
         ## realm in the session.  If not - we have to hope that 
         ## the realm can recognize its frozen user somehow.
-        if ($c->isa("Catalyst::Plugin::Session") && 
+        if ($c->can('session') && 
             $c->config->{'Plugin::Authentication'}{'use_session'} && 
             $c->session_is_valid) {
         
@@ -153,7 +153,7 @@ sub find_realm_for_persisted_user {
     my $c = shift;
     
     my $realm;
-    if ($c->isa("Catalyst::Plugin::Session")
+    if ($c->can('session')
         and $c->config->{'Plugin::Authentication'}{'use_session'}
         and $c->session_is_valid 
         and exists($c->session->{'__user_realm'})) {