1Catalyst::Model::LDAP::UCsoenrneCcotnitorni(b3u)ted PerlCaDtoacluymsetn:t:aMtoidoenl::LDAP::Connection(3)
2
3
4
6 Catalyst::Model::LDAP::Connection - Convenience methods for Net::LDAP
7
9 Subclass of Net::LDAP, which adds paging support and an additional
10 method to rebless the entries. See Catalyst::Model::LDAP::Entry for
11 more information.
12
14 If you want to override methods provided by Net::LDAP, you can use the
15 "connection_class" configuration variable. For example:
16
17 # In lib/MyApp/Model/LDAP.pm
18 package MyApp::Model::LDAP;
19 use base qw/Catalyst::Model::LDAP/;
20
21 __PACKAGE__->config(
22 # ...
23 connection_class => 'MyApp::LDAP::Connection',
24 );
25
26 1;
27
28 # In lib/MyApp/LDAP/Connection.pm
29 package MyApp::LDAP::Connection;
30 use base qw/Catalyst::Model::LDAP::Connection/;
31 use Authen::SASL;
32
33 sub bind {
34 my ($self, @args) = @_;
35
36 my $sasl = Authen::SASL->new(...);
37 push @args, sasl => $sasl;
38
39 $self->SUPER::bind(@args);
40 }
41
42 1;
43
45 new
46 Create a new connection to the specific LDAP server.
47
48 my $conn = Catalyst::Model::LDAP::Connection->new(
49 host => 'ldap.ufl.edu',
50 base => 'ou=People,dc=ufl,dc=edu',
51 );
52
53 On connection failure, an error is thrown using "croak" in Carp.
54
55 bind
56 Bind to the configured LDAP server using the specified credentials.
57
58 $conn->bind(
59 dn => 'uid=dwc,ou=People,dc=ufl,dc=edu',
60 password => 'secret',
61 );
62
63 This method behaves similarly to "bind" in Net::LDAP, except that it
64 gives an explicit name to the "dn" parameter. For example, if you need
65 to use SASL to bind to the server, you can specify that in your call:
66
67 $conn->bind(
68 dn => 'uid=dwc,ou=People,dc=ufl,dc=edu',
69 sasl => Authen::SASL->new(mechanism => 'GSSAPI'),
70 );
71
72 Additionally, if the "start_tls" configuration option is present, the
73 client will use "start_tls" in Net::LDAP to make your connection
74 secure.
75
76 For more information on customizing the bind process, see "OVERRIDING
77 METHODS".
78
79 search
80 Search the configured directory using a given filter. For example:
81
82 my $mesg = $c->model('Person')->search('(cn=Lou Rhodes)');
83 my $entry = $mesg->shift_entry;
84 print $entry->title;
85
86 This method overrides the "search" method in Net::LDAP to add paging
87 support. The following additional options are supported:
88
89 "page"
90 Which page to return.
91
92 "rows"
93 Rows to return per page. Defaults to 25.
94
95 "order_by"
96 Sort the records (on the server) by the specified attribute.
97 Required if you use "page".
98
99 When paging is active, this method returns the server response and a
100 Data::Page object. Otherwise, it returns the server response only.
101
103 · Catalyst::Model::LDAP
104
106 · Daniel Westermann-Clark
107
108 · Marcus Ramberg (paging support)
109
111 This library is free software; you can redistribute it and/or modify it
112 under the same terms as Perl itself.
113
114
115
116perl v5.12.0 2007-11-2C1atalyst::Model::LDAP::Connection(3)