[Catalyst-commits] r13503 - Catalyst-Authentication-Store-LDAP/branches/fix_connect_as_user_with_session/lib/Catalyst/Authentication/Store/LDAP

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Thu Aug 19 18:02:48 GMT 2010


Author: t0m
Date: 2010-08-19 19:02:48 +0100 (Thu, 19 Aug 2010)
New Revision: 13503

Modified:
   Catalyst-Authentication-Store-LDAP/branches/fix_connect_as_user_with_session/lib/Catalyst/Authentication/Store/LDAP/Backend.pm
   Catalyst-Authentication-Store-LDAP/branches/fix_connect_as_user_with_session/lib/Catalyst/Authentication/Store/LDAP/User.pm
Log:
I think this actually works

Modified: Catalyst-Authentication-Store-LDAP/branches/fix_connect_as_user_with_session/lib/Catalyst/Authentication/Store/LDAP/Backend.pm
===================================================================
--- Catalyst-Authentication-Store-LDAP/branches/fix_connect_as_user_with_session/lib/Catalyst/Authentication/Store/LDAP/Backend.pm	2010-08-19 16:16:29 UTC (rev 13502)
+++ Catalyst-Authentication-Store-LDAP/branches/fix_connect_as_user_with_session/lib/Catalyst/Authentication/Store/LDAP/Backend.pm	2010-08-19 18:02:48 UTC (rev 13503)
@@ -71,6 +71,7 @@
 
 use strict;
 use warnings;
+use Scalar::Util qw/refaddr/;
 
 our $VERSION = '1.011';
 
@@ -438,12 +439,11 @@
 sub from_session {
     my ( $self, $c, $id ) = @_;
     my $pass;
-    if ($id =~ s/,(.*)//) {
-        my $pass = $1;
-    }
+    ($id, $pass) = split /,/, $id;
     my $user = $self->get_user($id, $c);
     if ($pass) {
         $Catalyst::Authentication::Store::LDAP::User::_ldap_connection_passwords{refaddr($user)} = $pass;
+        warn("SET PASS FOR RESTORED USER TO $pass");
     }
     return $user;
 }

Modified: Catalyst-Authentication-Store-LDAP/branches/fix_connect_as_user_with_session/lib/Catalyst/Authentication/Store/LDAP/User.pm
===================================================================
--- Catalyst-Authentication-Store-LDAP/branches/fix_connect_as_user_with_session/lib/Catalyst/Authentication/Store/LDAP/User.pm	2010-08-19 16:16:29 UTC (rev 13502)
+++ Catalyst-Authentication-Store-LDAP/branches/fix_connect_as_user_with_session/lib/Catalyst/Authentication/Store/LDAP/User.pm	2010-08-19 18:02:48 UTC (rev 13503)
@@ -251,8 +251,13 @@
 
 sub ldap_connection {
     my $self = shift;
+    my $password = $_ldap_connection_passwords{refaddr($self)};
+    unless ($password) {
+        warn("No password stored with user, cannot restore from session");
+        return;
+    }
     $self->store->ldap_bind( undef, $self->ldap_entry->dn,
-        $_ldap_connection_passwords{refaddr($self)} );
+        $password );
 }
 
 =head2 AUTOLOADed methods




More information about the Catalyst-commits mailing list