This repository has been archived by the owner on May 14, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4
/
index.html
160 lines (146 loc) · 5.75 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
<!DOCTYPE html>
<html lang="en">
<head>
<title>ldapjs</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="media/css/style.css">
<link rel="stylesheet" type="text/css" href="media/css/highlight.css">
</head>
<body>
<div id="header">
<h1>ldapjs Documentation</h1>
</div>
<div id="sidebar">
<div>Sections</div>
<span>
<ul>
<li><div><a href="index.html">Home</a></div></li>
<li><div><a href="guide.html">Guide</a></div></li>
<li><div><a href="examples.html">Examples</a></div></li>
<li><div><a href="client.html">Client API</a></div></li>
<li><div><a href="server.html">Server API</a></div></li>
<li><div><a href="dn.html">DN API</a></div></li>
<li><div><a href="filters.html">Filters API</a></div></li>
<li><div><a href="errors.html">Error API</a></div></li>
</ul>
</span>
<div>Contents</div>
</span>
<ul>
<li>
<div>
<a href="#features">Features</a>
</div>
</li>
<li>
<div>
<a href="#getting-started">Getting started</a>
</div>
</li>
<li>
<div>
<a href="#more-information">More information</a>
</div>
</li>
<li>
<div>
<a href="#whats-not-in-the-box">What's not in the box?</a>
</div>
</li>
</ul>
</div>
<div id="content">
<div id="indextagline">
Reimagining <a href="http://tools.ietf.org/html/rfc4510" id="indextaglink">LDAP</a> for <a id="indextaglink" href="http://nodejs.org">Node.js</a>
</div>
<h1 id="overview">Overview</h1>
<div class="intro">
<p>ldapjs is a pure JavaScript, from-scratch framework for implementing
<a href="http://tools.ietf.org/html/rfc4510">LDAP</a> clients and servers in
<a href="http://nodejs.org">Node.js</a>. It is intended for developers used to interacting
with HTTP services in node and <a href="http://restify.com">restify</a>.</p>
</div>
<pre><code class="language-js"><span class="hljs-keyword">const</span> ldap = <span class="hljs-built_in">require</span>(<span class="hljs-string">'ldapjs'</span>);
<span class="hljs-keyword">const</span> server = ldap.<span class="hljs-title function_">createServer</span>();
server.<span class="hljs-title function_">search</span>(<span class="hljs-string">'o=example'</span>, <span class="hljs-function">(<span class="hljs-params">req, res, next</span>) =></span> {
<span class="hljs-keyword">const</span> obj = {
<span class="hljs-attr">dn</span>: req.<span class="hljs-property">dn</span>.<span class="hljs-title function_">toString</span>(),
<span class="hljs-attr">attributes</span>: {
<span class="hljs-attr">objectclass</span>: [<span class="hljs-string">'organization'</span>, <span class="hljs-string">'top'</span>],
<span class="hljs-attr">o</span>: <span class="hljs-string">'example'</span>
}
};
<span class="hljs-keyword">if</span> (req.<span class="hljs-property">filter</span>.<span class="hljs-title function_">matches</span>(obj.<span class="hljs-property">attributes</span>))
res.<span class="hljs-title function_">send</span>(obj);
res.<span class="hljs-title function_">end</span>();
});
server.<span class="hljs-title function_">listen</span>(<span class="hljs-number">1389</span>, <span class="hljs-function">() =></span> {
<span class="hljs-variable language_">console</span>.<span class="hljs-title function_">log</span>(<span class="hljs-string">'LDAP server listening at %s'</span>, server.<span class="hljs-property">url</span>);
});
</code></pre>
<p>Try hitting that with:</p>
<pre><code class="language-shell"><span class="hljs-meta prompt_">$ </span><span class="language-bash">ldapsearch -H ldap://localhost:1389 -x -b o=example objectclass=*</span>
</code></pre>
<h1 id="features">Features</h1>
<p>ldapjs implements most of the common operations in the LDAP v3 RFC(s), for
both client and server. It is 100% wire-compatible with the LDAP protocol
itself, and is interoperable with <a href="http://openldap.org">OpenLDAP</a> and any other
LDAPv3-compliant implementation. ldapjs gives you a powerful routing and
"intercepting filter" pattern for implementing server(s). It is intended
that you can build LDAP over anything you want, not just traditional databases.</p>
<h1 id="getting-started">Getting started</h1>
<pre><code class="language-shell"><span class="hljs-meta prompt_">$ </span><span class="language-bash">npm install ldapjs</span>
</code></pre>
<p>If you're new to LDAP, check out the <a href="guide.html">guide</a>. Otherwise, the
API documentation is:</p>
<table>
<thead>
<tr>
<th>Section</th>
<th>Content</th>
</tr>
</thead>
<tbody><tr>
<td><a href="server.html">Server API</a></td>
<td>Reference for implementing LDAP servers.</td>
</tr>
<tr>
<td><a href="client.html">Client API</a></td>
<td>Reference for implementing LDAP clients.</td>
</tr>
<tr>
<td><a href="dn.html">DN API</a></td>
<td>API reference for the DN class.</td>
</tr>
<tr>
<td><a href="filters.html">Filter API</a></td>
<td>API reference for LDAP search filters.</td>
</tr>
<tr>
<td><a href="errors.html">Error API</a></td>
<td>Listing of all ldapjs Error objects.</td>
</tr>
<tr>
<td><a href="examples.html">Examples</a></td>
<td>Collection of sample/getting started code.</td>
</tr>
</tbody></table>
<h1 id="more-information">More information</h1>
<ul>
<li>License:<a href="http://opensource.org/licenses/mit-license.php">MIT</a></li>
<li>Code: <a href="https://github.com/ldapjs/node-ldapjs">ldapjs/node-ldapjs</a></li>
</ul>
<h1 id="whats-not-in-the-box">What's not in the box?</h1>
<p>Since most developers and system(s) adminstrators struggle with some of the
esoteric features of LDAP, not all features in LDAP are implemented here.
Specifically:</p>
<ul>
<li>LDIF</li>
<li>Aliases</li>
<li>Attributes by OID</li>
<li>Extensible matching</li>
</ul>
<p>There are a few others, but those are the "big" ones.</p>
</div><!-- end #content -->
</body>
</html>