1LWP::Protocol::ldap(3)User Contributed Perl DocumentationLWP::Protocol::ldap(3)
2
3
4
6 LWP::Protocol::ldap - Provide LDAP support for LWP::UserAgent
7
9 use LWP::UserAgent;
10
11 $ua = LWP::UserAgent->new();
12 $res = $ua->get('ldap://ldap.example.com/' .
13 'o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)',
14 Accept => 'text/json'):
15
17 The LWP::Protocol::ldap module provides support for using ldap schemed
18 URLs following RFC 4516 with LWP. This module is a plug-in to the LWP
19 protocol handling, so you don't use it directly.
20
21 In addition to being used with LDAP URIs, LWP::Protocol::ldap also acts
22 as the base class for its sibling modules LWP::Protocol::ldaps and
23 LWP::Protocol::ldapi.
24
25 Features
26 HTTP methods supported
27
28 LWP::Protocol::ldap implements the HTTP GET and HEAD methods. They are
29 mapped to the LDAP search operation,
30
31 Response format
32
33 Depending on the HTTP Accept header provided by the user agent,
34 LWP::Protocol::ldap can answer the requests in one of the following
35 formats:
36
37 DSML
38 When the HTTP Accept header contains the "text/dsml" MIME type, the
39 response is sent as DSMLv1.
40
41 JSON
42 When the HTTP Accept header contains the "text/json" MIME type, the
43 response is sent as JSON. For this to work the JSON Perl module
44 needs to be installed.
45
46 LDIF
47 When the HTTP Accept header contains the "text/ldif" MIME type, the
48 response is sent in LDIFv1 format.
49
50 HTML
51 In case no HTTP Accept header has been sent or none of the above
52 MIME types can be detected, and the x-format extension has not been
53 provided either, the response is sent using HTML markup in a
54 2-column table format (roughly modeled on LDIF).
55
56 As an alternative to sending an HTTP Accept header, LWP::Protocol::ldap
57 also accepts the "x-format" extension
58
59 Example:
60
61 ldap://ldap.example.com/o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)?x-format=dsml
62
63 TLS support
64
65 For ldap and ldapi URIs, the module implements the "x-tls" extension
66 that switches the LDAP connection to TLS using a call of the start_tls
67 method.
68
69 Example:
70
71 ldap://ldap.example.com/o=University%20of%20Michigan,c=US??sub?(cn=Babs%20Jensen)?x-tls=1
72
73 Note: In the above example, ideally giving "x-tls" should be
74 sufficient, but unfortunately the parser in URI::ldap has a little
75 flaw.
76
77 Authorization
78
79 Usually the connection is done anonymously, but if the HTTP
80 Authorization header is provided with credentials for HTTP Basic
81 authorization, the credentials given in that header will be used to do
82 a simple bind to the LDAP server.
83
85 LWP::Protocol::ldaps, LWP::Protocol::ldapi
86
88 Copyright (c) 1998-2004 Graham Barr, 2012 Peter Marschall. All rights
89 reserved. This program is free software; you can redistribute it
90 and/or modify it under the same terms as Perl itself.
91
92
93
94perl v5.16.3 2013-06-08 LWP::Protocol::ldap(3)