1 |
package A3C::LDAP; |
2 |
|
3 |
use strict; |
4 |
use warnings; |
5 |
|
6 |
use Net::LDAP; |
7 |
use Data::Dump qw/dump/; |
8 |
use base 'Jifty::Object'; |
9 |
|
10 |
my $ldap_config = Jifty->config->app('LDAP'); |
11 |
|
12 |
Jifty->log->debug( "config->app(LDAP) = ",dump( $ldap_config ) ); |
13 |
|
14 |
my $ldap = Net::LDAP->new( $ldap_config->{Server} ) or die "$@"; |
15 |
|
16 |
# an anonymous bind |
17 |
#my $mesg = $ldap->bind; |
18 |
my $mesg = $ldap->bind( $ldap_config->{DN}, password => $ldap_config->{Password} ); |
19 |
|
20 |
Jifty->log->info("Connected to ", $ldap_config->{Server}, " with DN ", $ldap_config->{DN}); |
21 |
|
22 |
sub search { |
23 |
my $self = shift; |
24 |
|
25 |
return $ldap->search( @_ ); |
26 |
} |
27 |
|
28 |
1; |