Walter Vargas wrote:
I'm working with *Catalyst::Authentication::Store::LDAP and Catalyst::Model::LDAP*, but i dont want use SSL, i want use SASL how to do that ?

Neither of these support SASL, but it would be easy to add.

Net::LDAP->bind($dn, password => 'password'); # What happens currently
my $sasl_object = Net::SASL->new(%p);
Net::LDAP->bind($dn, sasl => $sasl_object);   # What you want to do instead.

I've attached a nasty, hacky, untested patch to make SASL work. I'm sure that you can make it less horrible, make the creation of the Authen::SASL object easier / not manual, provide documentation etc...

Cheers
t0m



Index: lib/Catalyst/Authentication/Store/LDAP/Backend.pm
===================================================================
--- lib/Catalyst/Authentication/Store/LDAP/Backend.pm	(revision 9530)
+++ lib/Catalyst/Authentication/Store/LDAP/Backend.pm	(working copy)
@@ -85,6 +85,7 @@
 use Catalyst::Authentication::Store::LDAP::User;
 use Net::LDAP;
 use Catalyst::Utils ();
+use Scalar::Util qw/blessed/;
 
 BEGIN {
     __PACKAGE__->mk_accessors(
@@ -227,7 +228,14 @@
     }
     else {
         if ($bindpw) {
-            my $mesg = $ldap->bind( $binddn, 'password' => $bindpw );
+            my %p;
+            if (blessed($bindpw) && $bindpw->isa('Authen::SASL')) {
+                $p{sasl} = $bindpw;
+            }
+            else {
+                $p{password} = $bindpw;
+            }
+            my $mesg = $ldap->bind( $binddn, %p );
             if ( $mesg->is_error ) {
 
                 # If we're not checking this bind for authentication purposes
_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to