[Catalyst-commits] r12298 - in Catalyst-Authentication-Store-LDAP/trunk: . lib/Catalyst/Authentication/Store/LDAP

t0m at dev.catalyst.perl.org t0m at dev.catalyst.perl.org
Thu Dec 10 17:25:42 GMT 2009


Author: t0m
Date: 2009-12-10 17:25:41 +0000 (Thu, 10 Dec 2009)
New Revision: 12298

Modified:
   Catalyst-Authentication-Store-LDAP/trunk/
   Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP/User.pm
Log:
 r27882 at omni (orig r9910):  t0m | 2009-04-28 13:35:52 +0100
 Initial idea - make the user class instance have a closure which when called will retrieve an LDAP connection bound as the user, not so pleasant, but better than saving the password in the user object in plaintext..
 



Property changes on: Catalyst-Authentication-Store-LDAP/trunk
___________________________________________________________________
Name: svk:merge
   + 4ad37cd2-5fec-0310-835f-b3785c72a374:/Catalyst-Authentication-Store-LDAP/branches/better_model_integration:9910

Modified: Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP/User.pm
===================================================================
--- Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP/User.pm	2009-12-10 17:24:15 UTC (rev 12297)
+++ Catalyst-Authentication-Store-LDAP/trunk/lib/Catalyst/Authentication/Store/LDAP/User.pm	2009-12-10 17:25:41 UTC (rev 12298)
@@ -51,7 +51,7 @@
 
 our $VERSION = '0.1005';
 
-BEGIN { __PACKAGE__->mk_accessors(qw/user store/) }
+BEGIN { __PACKAGE__->mk_accessors(qw/user store _ldap_connection/) }
 
 use overload '""' => sub { shift->stringify }, fallback => 1;
 
@@ -141,10 +141,13 @@
         'forauth' );
     if ( defined($ldap) ) {
         if ($self->store->role_search_as_user) {
+            # FIXME - This can be removed and made to use the code below..
             # Have to do the role lookup _now_, as this is the only time
             # that we have the user's password/ldap bind..
             $self->roles($ldap);
         }
+        # Stash a closure which can be used to retrieve the connection in the users context later.
+        $self->_ldap_connection( sub { $self->store->ldap_bind( undef, $self->ldap_entry->dn, $password ) } );
         return 1;
     }
     else {




More information about the Catalyst-commits mailing list