Catalyst::Model::LDAP - LDAP model class for Catalyst
# Use the Catalyst helper script/myapp_create.pl model Person LDAP ldap.ufl.edu ou=People,dc=ufl,dc=edu # Or, in lib/MyApp/Model/Person.pm package MyApp::Model::Person; use base qw/Catalyst::Model::LDAP/; __PACKAGE__->config( host => 'ldap.ufl.edu', base => 'ou=People,dc=ufl,dc=edu', ); 1; # Then, in your controller my $mesg = $c->model('Person')->search('(cn=Lou Rhodes)'); my @entries = $mesg->entries; print $entries->sn;
This class simplifies LDAP access by letting you configure a common set of bind arguments. It also lets you configure a base DN for searching.
Please refer to the Net::LDAP documentation for information on what else is available.
The following configuration parameters are supported:
The LDAP server's fully qualified domain name (FQDN), e.g.
ldap.ufl.edu. Can also be an IP address, e.g.
The base distinguished name (DN) for searching the directory, e.g.
(Optional) The bind DN for connecting to the directory, e.g.
dn=admin,dc=ufl,dc=edu. This can be anyone that has permission to search under the base DN, as per your LDAP server's access control lists.
(Optional) The password for the specified bind DN.
(Optional) Set to
1 to use TLS when binding to the LDAP server, for secure connections.
(Optional) A hashref containing options to use when binding using TLS to the LDAP server.
(Optional) A hashref containing options to pass to "search" in Catalyst::Model::LDAP::Connection. For example, this can be used to set a sizelimit.
NOTE: In previous versions, these options were passed to all Net::LDAP methods. This has changed to allow a cleaner connection interface. If you still require this behavior, create a class inheriting from Catalyst::Model::LDAP::Connection that overrides the specific methods and set
Bind the client using the current configuration and return it. This method is automatically called when you use e.g.
See "bind" in Catalyst::Model::LDAP::Connection for information on how the bind operation is done.
Daniel Westermann-Clark <email@example.com>
Adam Jacob <firstname.lastname@example.org> (TLS support)
Marcus Ramberg (paging support and entry AUTOLOAD)
Salih Gonullu, for initial work on Catalyst mailing list
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.