Fugly, but probably workable
Tomas Doran [Mon, 16 Aug 2010 09:45:08 +0000 (09:45 +0000)]
lib/Catalyst/Authentication/Store/LDAP/Backend.pm
lib/Catalyst/Authentication/Store/LDAP/User.pm

index 5602802..c601e59 100644 (file)
@@ -437,7 +437,15 @@ Returns get_user() for I<id>.
 
 sub from_session {
     my ( $self, $c, $id ) = @_;
-    $self->get_user($id, $c);
+    my $pass;
+    if ($id =~ s/,(.*)//) {
+        my $pass = $1;
+    }
+    my $user = $self->get_user($id, $c);
+    if ($pass) {
+        $Catalyst::Authentication::Store::LDAP::User::_ldap_connection_passwords{refaddr($user)} = $pass;
+    }
+    return $user;
 }
 
 1;
index 8141bc8..5a21827 100644 (file)
@@ -56,7 +56,7 @@ BEGIN { __PACKAGE__->mk_accessors(qw/user store/) }
 
 use overload '""' => sub { shift->stringify }, fallback => 1;
 
-my %_ldap_connection_passwords; # Store inside-out so that they don't show up
+our %_ldap_connection_passwords; # Store inside-out so that they don't show up
                                 # in dumps..
 
 =head1 METHODS
@@ -180,7 +180,10 @@ Returns the User object, stringified.
 
 sub for_session {
     my $self = shift;
-    return $self->stringify;
+    my $id = $self->stringify;
+    if ($_ldap_connection_passwords{refaddr($self)}) {
+        $id .= ',' . $_ldap_connection_passwords{refaddr($self)};
+    }
 }
 
 =head2 ldap_entry