[Catalyst-commits] r9910 -
Catalyst-Authentication-Store-LDAP/branches/better_model_integration/lib/Catalyst/Authentication/Store/LDAP
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Tue Apr 28 12:35:53 GMT 2009
Author: t0m
Date: 2009-04-28 13:35:52 +0100 (Tue, 28 Apr 2009)
New Revision: 9910
Modified:
Catalyst-Authentication-Store-LDAP/branches/better_model_integration/lib/Catalyst/Authentication/Store/LDAP/User.pm
Log:
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..
Modified: Catalyst-Authentication-Store-LDAP/branches/better_model_integration/lib/Catalyst/Authentication/Store/LDAP/User.pm
===================================================================
--- Catalyst-Authentication-Store-LDAP/branches/better_model_integration/lib/Catalyst/Authentication/Store/LDAP/User.pm 2009-04-28 12:30:51 UTC (rev 9909)
+++ Catalyst-Authentication-Store-LDAP/branches/better_model_integration/lib/Catalyst/Authentication/Store/LDAP/User.pm 2009-04-28 12:35:52 UTC (rev 9910)
@@ -51,7 +51,7 @@
our $VERSION = '0.1004';
-BEGIN { __PACKAGE__->mk_accessors(qw/user store/) }
+BEGIN { __PACKAGE__->mk_accessors(qw/user store _ldap_connection/) }
use overload '""' => sub { shift->stringify }, fallback => 1;
@@ -139,10 +139,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