Connector
view release on metacpan or search on metacpan
lib/Connector/Proxy/Net/LDAP.pm view on Meta::CPAN
if (!$dn) {
$self->_log_and_die('Empty dn part in splitDN');
}
# Split last remainder at =
my @last = split ("=", $dn);
push @parsed, \@last;
return @parsed;
}
sub _run_search {
my $self = shift;
my $arg = shift;
my $params = shift;
my %option = $self->_build_search_options( $arg, $params );
my $mesg = $self->ldap()->search( %option );
# Lost connection, try to rebind and rerun query
if ($self->_is_transient_error($mesg)) {
$mesg = $self->ldap()->search( %option );
}
return $mesg;
}
no Moose;
__PACKAGE__->meta->make_immutable;
1;
__END__
=head1 NAME
Connector::Proxy::Net::LDAP
=head1 DESCRIPTION
This is the base class for all LDAP Proxy modules. It does not offer any
external functionality but bundles common configuration options.
=head1 USAGE
=head2 minimal setup
my $conn = Connector::Proxy::Net::LDAP->new({
LOCATION => 'ldap://localhost:389',
base => 'dc=example,dc=org',
filter => '(cn=[% ARGS.0 %])',
});
$conn->get('John Doe');
Above code will run a query of C<cn=test@example.org against the server>
using an anonymous bind.
=head2 using bind credentials
my $conn = Connector::Proxy::Net::LDAP->new( {
LOCATION => 'ldap://localhost:389',
base => 'dc=example,dc=org',
filter => '(cn=[% ARGS.0 %])',
binddn => 'cn=admin,dc=openxpki,dc=org',
password => 'admin',
attrs => ['usercertificate;binary','usercertificate'],
});
Uses bind credentials and queries for entries having (at least) one of the
mentioned attributes.
=head2 connection control
Following controls are passed to Net::LDAP->new from class parameters
with the same name, see Net::LDAP for details.
=over
=item timeout
=item keepalive
=item multihomed
=item localaddr
=item debug
=item raw
Enables utf8 for returned attribute values. The default value is
qr/;binary/, set this to a Regex reference to change the attribute
pattern for utf8 conversion or set I<undef> to disable it.
=back
=head3 SSL connection options
SSl related options are passed to Net::LDAP->new, see Net::LDAP for
details. The attribute names in brackets are identical to the ones
used in the HTTP based connectors and mapped to their equivalents.
Note that mapping takes place at first init, so modifications to those
values after the first connection will not be visibile. The native
parameter names are superior.
=over
=item verify (ssl_ignore_mode - 'reqiured' if true)
=item sslversion
=item ciphers
=item capath (ca_certificate_path)
=item cafile (ca_certificate_file)
=item clientcert (certificate_file)
=item clientkey (certificate_key_file)
=item checkcrl
=back
=head2 setting values
You can control how existing attributes in the node are treated setting the
( run in 0.995 second using v1.01-cache-2.11-cpan-39bf76dae61 )