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 version 0.21
10
12 Subclass of Net::LDAP, which adds paging support and an additional
13 method to rebless the entries. See Catalyst::Model::LDAP::Entry for
14 more information.
15
17 If you want to override methods provided by Net::LDAP, you can use the
18 "connection_class" configuration variable. For example:
19
20 # In lib/MyApp/Model/LDAP.pm
21 package MyApp::Model::LDAP;
22 use base qw/Catalyst::Model::LDAP/;
23
24 __PACKAGE__->config(
25 # ...
26 connection_class => 'MyApp::LDAP::Connection',
27 );
28
29 1;
30
31 # In lib/MyApp/LDAP/Connection.pm
32 package MyApp::LDAP::Connection;
33 use base qw/Catalyst::Model::LDAP::Connection/;
34 use Authen::SASL;
35
36 sub bind {
37 my ($self, @args) = @_;
38
39 my $sasl = Authen::SASL->new(...);
40 push @args, sasl => $sasl;
41
42 $self->SUPER::bind(@args);
43 }
44
45 1;
46
48 new
49 Create a new connection to the specific LDAP server.
50
51 my $conn = Catalyst::Model::LDAP::Connection->new(
52 host => 'ldap.ufl.edu',
53 base => 'ou=People,dc=ufl,dc=edu',
54 );
55
56 On connection failure, an error is thrown using "croak" in Carp.
57
58 bind
59 Bind to the configured LDAP server using the specified credentials.
60
61 $conn->bind(
62 dn => 'uid=dwc,ou=People,dc=ufl,dc=edu',
63 password => 'secret',
64 );
65
66 This method behaves similarly to "bind" in Net::LDAP, except that it
67 gives an explicit name to the "dn" parameter. For example, if you need
68 to use SASL to bind to the server, you can specify that in your call:
69
70 $conn->bind(
71 dn => 'uid=dwc,ou=People,dc=ufl,dc=edu',
72 sasl => Authen::SASL->new(mechanism => 'GSSAPI'),
73 );
74
75 Additionally, if the "start_tls" configuration option is present, the
76 client will use "start_tls" in Net::LDAP to make your connection
77 secure.
78
79 For more information on customizing the bind process, see "OVERRIDING
80 METHODS".
81
82 search
83 Search the configured directory using a given filter. For example:
84
85 my $mesg = $c->model('Person')->search('(cn=Lou Rhodes)');
86 my $entry = $mesg->shift_entry;
87 print $entry->title;
88
89 This method overrides the "search" method in Net::LDAP to add paging
90 support. The following additional options are supported:
91
92 "raw"
93 Use REGEX to denote the names of attributes that are to be
94 considered binary in search results.
95
96 When this option is given, Net::LDAP converts all values of
97 attributes not matching this REGEX into Perl UTF-8 strings so that
98 the regular Perl operators (pattern matching, ...) can operate as
99 one expects even on strings with international characters.
100
101 If this option is not given, attribute values are treated as byte
102 strings.
103
104 Generally, you'll only ever need to do this if using RFC'd LDAP
105 attributes and not a custom LDAP schema:
106
107 raw => qr/(?i:^jpegPhoto|;binary)/,
108
109 "authz"
110 This allows you to use LDAPv3 Proxy Authorization control object,
111 i.e. (Net::LDAP::Control::ProxyAuth):
112
113 authz => 'uid=gavinhenry,ou=users,dc=surevoip,dc=co,dc=uk',
114
115 "page"
116 Which page to return.
117
118 "rows"
119 Rows to return per page. Defaults to 25.
120
121 "order_by"
122 Sort the records (on the server) by the specified attribute.
123 Required if you use "page".
124
125 When paging is active, this method returns the server response and a
126 Data::Page object. Otherwise, it returns the server response only.
127
129 • Catalyst::Model::LDAP
130
132 • Daniel Westermann-Clark
133
134 • Marcus Ramberg (paging support)
135
136 • Gavin Henry <ghenry@surevoip.co.uk> (authz and raw support, plus
137 bug fixes)
138
140 This library is free software; you can redistribute it and/or modify it
141 under the same terms as Perl itself.
142
144 Gavin Henry <ghenry@surevoip.co.uk>
145
147 This software is copyright (c) 2017 by Gavin Henry.
148
149 This is free software; you can redistribute it and/or modify it under
150 the same terms as the Perl 5 programming language system itself.
151
152
153
154perl v5.32.1 2021-01-2C6atalyst::Model::LDAP::Connection(3)