The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

OpenPlugin::Datasource::LDAP - Centralized connection location to LDAP directories

SYNOPSIS

 # Define the parameters for an LDAP connection called 'primary'

 <datasource primary>
    type          = LDAP
    host          = localhost
    port          = 389
    base_dn       = dc=mycompany, dc=com
    timeout       = 120
    version       = 2
    sasl          =
    debug         =
    bind_dn       = cn=webuser, ou=People, dc=mycompany, dc=com
    bind_password = urkelnut
    perform_bind  = yes
 </datasource>

 # Request the datasource 'primary' from the $OP object

 my $ldap = $OP->datasource->connect( 'primary' );
 my $mesg =  $ldap->search( "urkelFan=yes" );
 ...

DESCRIPTION

Connect and/or bind to an LDAP directory.

METHODS

connect( $datasource_name, \%datasource_info )

Parameters used in \%datsource_info

  • host: host LDAP server is running on

  • port: defaults to 389

  • debug: see Net::LDAP for what this will do

  • timeout: defaults to 120

  • version: defaults to 2; version of the LDAP protocol to use.

  • perform_bind: if true, we perform a bind (using 'bind_dn' and 'bind_password') when we connect to the LDAP directory

  • bind_dn: DN to bind with (if requested to bind)

  • bind_password: password to bind with (if requested to bind)

  • sasl: if true, use SASL when binding (if requested to bind)

Returns:

If success, a valid Net::LDAP connection handle is returned.

Failure will cause an exception to be thrown.

bind( $ldap_connection, \%bind_params )

Bind an LDAP connection using a DN/password combination. With many servers, you can do this more than once with a single connection.

Parameters used:

  • bind_dn: DN to bind as.

  • bind_password: Password to use when binding.

  • sasl: If set to true, use SASL for authentication. Note: this is completely untested, and even if it works it only uses the CRAM-MD5 method of authentication.

Returns: LDAP handle with bind() run, or calls die to explain why it failed.

connect_and_bind( \%connect_params, \%other_params )

Run both the connect() and bind() methods.

BUGS

None known.

TO DO

Nothing known.

SEE ALSO

Net::LDAP

COPYRIGHT

Copyright (c) 2001-2003 Eric Andreychek. All rights reserved.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHORS

Eric Andreychek <eric@openthought.net>

Chris Winters <chris@cwinters.com>