Repository navigation
Expand file tree
/
Copy pathREADME
More file actions
187 lines (141 loc) · 5.39 KB
/
Copy pathREADME
File metadata and controls
187 lines (141 loc) · 5.39 KB
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
RESTFul API for handler for OpenDS.
Author: Mike Dugan
BUILDING
0. Download, build and test OpenDS.
1. Download Jersey Jars.
Download this zip from Jersey distribution:
http://download.java.net/maven/2/com/sun/jersey/jersey-archive/1.3/jersey-archive-1.3.zip
Unzip and copy all jars in "jersey-archive-1.3/lib" into "opends/lib" source directory.
Files are:
asm-3.1.jar
jersey-json-1.3.jar
jackson-core-asl-1.1.1.jar
jersey-server-1.3.jar
jersey-client-1.3.jar
jettison-1.1.jar
jersey-core-1.3.jar
jsr311-api-1.1.1.jar
2. Download Grizzley Jar.
Download grizzly embedded servlet container:
http://download.java.net/maven/glassfish/com/sun/grizzly/grizzly-servlet-webserver/1.9.18-k/grizzly-servlet-webserver-1.9.18-k.jar
Copy to "opends/lib" source directory
3. Re-build OpenDS and start server.
CONFIGURATION
1. Add objectclass found in schema/http_schema.ldif
ldapmodify.bat -c -a -p 4444 -D "cn=directory manager" -w password -X --useSSL -f http_schema.ldif
Stop server
1. Non-SSL configuration of OpenDS RestFUL API handler.
Open an editor and add this stanza after LDAPS stanza config.ldif:
dn: cn=HTTP Connection Handler,cn=Connection Handlers,cn=config
objectClass: top
objectClass: ds-cfg-connection-handler
objectClass: ds-cfg-http-connection-handler
cn: HTTP Connection Handler
ds-cfg-java-class: org.opends.server.protocols.http.HTTPConnectionHandler
ds-cfg-enabled: true
ds-cfg-listen-port: 8080
ds-cfg-identity-mapper: cn=Exact Match,cn=Identity Mappers,cn=config
Note: change the port if needed.
2. Re-start the server
3. Test. Add some entries with passwords:
ldapmodify.bat -c -a -D "cn=directory manager" -w password -f ex.ldif
head ex.ldif
dn: dc=example,dc=com
objectClass: top
objectClass: domain
dc: example
dn: ou=People,dc=example,dc=com
objectClass: top
objectClass: organizationalunit
ou: People
dn: uid=user.0,ou=People,dc=example,dc=com
objectClass: top
objectClass: person
objectClass: organizationalperson
objectClass: inetorgperson
givenName: Aaccf
sn: Amar
cn: Aaccf Amar
initials: ASA
employeeNumber: 0
uid: user.0
mail: user.0@example.com
userPassword: password
telephoneNumber: +1 294 867 8160
homePhone: +1 078 441 7013
pager: +1 973 405 8217 begin_of_the_skype_highlighting +1 973 405 8217 end_of_the_skype_highlighting
mobile: +1 260 148 0630
street: 24672 Davis Street
l: Flint
st: TX
postalCode: 43306
postalAddress: Aaccf Amar$24672 Davis Street$Flint, TX 43306
description: This is the description for Aaccf Amar.
dn: uid=user.1,ou=People,dc=example,dc=com
objectClass: top
objectClass: person
objectClass: organizationalperson
objectClass: inetorgperson
givenName: Aaren
sn: Atp
cn: Aaren Atp
initials: ALA
employeeNumber: 1
uid: user.1
mail: user.1@example.com
userPassword: password
telephoneNumber: +1 776 003 5757
homePhone: +1 405 589 1050
pager: +1 557 202 7946
mobile: +1 665 568 0659
street: 51093 Green Street
l: Flint
st: CT
postalCode: 20660
postalAddress: Aaren Atp$51093 Green Street$Flint, CT 20660
description: This is the description for Aaren Atp.
...
Download a copy of cURL from: http://curl.haxx.se/download.html
SEARCHING
Using the default values:
curl -u user.0:password "http://localhost:8080/directory/search?base=dc=example,dc=com"
{"dc=example,dc=com":{"dn":"dc=example,dc=com","objectclass":["domain","top"],"attributes":{"dc":"example"}}}
Specifying a scope of sub:
curl -u user.0:password "http://localhost:8080/directory/search?base=dc=example,dc=com&scope=sub"
...
Specifying a scope of one and filter of (uid=fost*):
curl -u user.0:password "http://localhost:8080/directory/search?base=dc=example,dc=com&filter=(uid=fost*)&scope=one"
...
Specifying a scope of one, filter of (uid=fost*) and return cn, sn attributes:
curl -u user.0:password "http://localhost:8080/directory/search?base=dc=example,dc=com&filter=(uid=fost*)&scope=sub&attrs=cn,sn"
The default are the same as ldapsearch:
scope: base
filter: (objectclass=*)
attrs: all
DELETE an entry:
Assumes there is a uid=user.5 entry in the directory and that user has delete ACI. The delete ACI is
important.
curl -X DELETE -u user.5:password "http://localhost:8080/directory/uid=user.2,ou=people,dc=example,dc=com"
==
ADD an entry in JSON format to the directory using curl.
- Assumes there is a uid=user.5 entry in the directory and that user has add ACI.
- Again the add ACI is important.
- The file json.out2 contains the json format of the entry.
curl -v -H "Content-Type: application/json" -X POST -d @json.out2 -u user.5:password "http://localhost:8080/directory/add"
cat json.out2:
{"dn":"uid=user.555,ou=People,dc=example,dc=com",
"objectclass":["person","inetorgperson","organizationalperson","top"],
"attributes":[
{"postalAddress":"Abagail Abadines$73160 Eleventh Street$Charlotte, NH 51997"},
{"postalCode":"51997"},{"description":"This is the description for Abagail Abadines."},
{"uid":"user.555"},{"userPassword":"password"},{"employeeNumber":"6"},{"initials":"AWA"},
{"givenName":"Abagail"},{"pager":"+1 120 345 8065"},{"mobile":"+1 808 056 4376 begin_of_the_skype_highlighting +1 808 056 4376 end_of_the_skype_highlighting"},
{"cn":"Abagail Abadines"},{"telephoneNumber":"+1 994 686 5918"},{"sn":"Abadines"},
{"street":"73160 Eleventh Street"},
{"homePhone":"+1 356 416 7060"},{"l":"Charlotte"},
{"mail":"user.6@example.com"},{"st":"NH"}
]}
==
Modify in progress.
==
SSL is supported, directions are being written.