SingleSignOn.xml
13 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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
<?xml version="1.0" encoding="UTF-8"?>
<!--
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<chapter xml:id="CASLDAP" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
version="5.0" xmlns:xl="http://www.w3.org/1999/xlink" xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:schemaLocation="http://docbook.org/ns/docbook ../../applications/content/dtd/docbook.xsd"
xmlns="http://docbook.org/ns/docbook">
<title>OFBiz Single Sign On using CAS and LDAP</title>
<section>
<title>Setup the Java Key Store</title>
<para>
From the directory in which you want to create the keystore, run keytool with the following parameters.
</para>
<orderedlist>
<listitem>
<para>
Generate the server certificate.
<programlisting>
$ keytool -genkey -alias tomcat -keyalg RSA -keypass changeit -storepass changeit -keystore keystore.jks
</programlisting>
When you press Enter, keytool prompts you to enter the server name, organizational unit, organization, locality, state, and country code. Note that you must enter the server name in response to keytool's first prompt, in which it asks for first and last names. For testing purposes, this can be localhost.
</para>
</listitem>
<listitem>
<para>
Export the generated server certificate in keystore.jks into the file server.cer.
<programlisting>
$ keytool -export -alias tomcat -storepass changeit -file server.cer -keystore keystore.jks
</programlisting>
</para>
</listitem>
<listitem>
<para>
To create the trust-store file cacerts.jks and add the server certificate to the trust-store, run keytool from the directory where you created the keystore and server certificate. Use the following parameters:
<programlisting>
$ keytool -import -v -trustcacerts -alias tomcat -file server.cer -keystore cacerts.jks -keypass changeit -storepass changeit
</programlisting>
</para>
</listitem>
<listitem>
<para>
Information on the certificate, such as that shown next, will display.
<programlisting>
$ keytool -import -v -trustcacerts -alias tomcat -file server.cer -keystore cacerts.jks -keypass changeit -storepass changeit
Owner: CN=localhost, OU=Sun Micro, O=Docs, L=Santa Clara, ST=CA, C=US
Issuer: CN=localhost, OU=Sun Micro, O=Docs, L=Santa Clara, ST=CA, C=US
Serial number: 3e932169
Valid from: Tue Apr 08
Certificate fingerprints:
MD5: 52:9F:49:68:ED:78:6F:39:87:F3:98:B3:6A:6B:0F:90
SHA1: EE:2E:2A:A6:9E:03:9A:3A:1C:17:4A:28:5E:97:20:78:3F:
Trust this certificate? [no]:
</programlisting>
</para>
</listitem>
<listitem>
<para>
Enter yes, and then press the Enter or Return key. The following information displays:
<programlisting>
Certificate was added to keystore
[Saving cacerts.jks]
</programlisting>
</para>
</listitem>
</orderedlist>
</section>
<section>
<title>CAS Server</title>
<para>
<orderedlist>
<listitem>
<para>
Download CAS server from <link xl:href="http://www.jasig.org/cas">the CAS web site</link>.
</para>
</listitem>
<listitem>
<para>
Deploy cas-server-webapp-[version].war to Tomcat
</para>
</listitem>
<listitem>
<para>
Set key store file to Tomcat
<programlisting>
keystoreFile="path/to/keystore.jks"
</programlisting>
</para>
</listitem>
<listitem>
<para>
Start Tomcat
</para>
</listitem>
</orderedlist>
</para>
</section>
<section>
<title>OFBiz Certificate</title>
<para>
Set trust store's file to Java Virtual Machine (JVM) before start OFBiz.
<programlisting>
-Djavax.net.ssl.trustStore=path/to/cacerts.jks
</programlisting>
</para>
</section>
<section>
<title>LDAP Component</title>
<para>
OFBiz uses the LDAP component in the specialpurpose to check the security in a web application. OFBiz disabled LDAP component as default, you can enable this component by take the comment out from specialpurpose/component-load.xml file.
</para>
<section>
<title>LDAP Properties</title>
<para>
LDAP properties file is specialpurpose/ldap/config/ldap.xml. You can change a filter condition you want.
</para>
<section>
<title>Attributes</title>
<para>
<orderedlist>
<listitem>
<para>
Attribute : LDAP attbitue for filter e.g. uid=%u
</para>
</listitem>
<listitem>
<para>
AuthenType : LDAP authentication method e.g. simple
</para>
</listitem>
<listitem>
<para>
AuthenticaionHandler : CAS handler class e.g. org.ofbiz.ldap.cas.OFBizCasAuthenticationHandler
</para>
</listitem>
<listitem>
<para>
AutoPartyId : Party's id for user login e.g. admin
</para>
</listitem>
<listitem>
<para>
AutoSecurityGroupId : Security group's id for user login e.g. FULLADMIN
</para>
</listitem>
<listitem>
<para>
BaseDN : The top level ofbiz LDAP directory tree e.g. dc=example,dc=com
</para>
</listitem>
<listitem>
<para>
Filter : LDAP search filter e.g. (objectclass=*)
</para>
</listitem>
<listitem>
<para>
Scope : LDAP search scope parameter e.g. sub,one, etc.
</para>
</listitem>
<listitem>
<para>
URL : LDAP server's url e.g. ldap://localhost:389
</para>
</listitem>
<listitem>
<para>
UserOFBizLoginWhenLDAPFail : indicate that if LDAP fail then login with normal OFBiz's user or not. (true/false)
</para>
</listitem>
</orderedlist>
</para>
</section>
<section>
<title>CAS</title>
<para>
<orderedlist>
<listitem>
<para>
CasLoginUri : URI to CAS login e.g. /login
</para>
</listitem>
<listitem>
<para>
CasLogoutUri : URI to CAS logout e.g. /logout
</para>
</listitem>
<listitem>
<para>
CasUrl : CAS Server's URL e.g. https://localhost:8443/cas
</para>
</listitem>
<listitem>
<para>
CasValidateUri : URI to CAS validate e.g. /validate
</para>
</listitem>
<listitem>
<para>
CasLdapHandler : LDAP hanlder class e.g. org.ofbiz.ldap.openldap.OFBizLdapAuthenticationHandler
</para>
</listitem>
<listitem>
<para>
CasTGTCookieName : CAS TGT's cookie name e.g. CASTGC
</para>
</listitem>
</orderedlist>
</para>
</section>
</section>
</section>
<section>
<title>OpenLDAP</title>
<para>
The LDAP component need data from LDAP server (OpenLDAP). The server needs to install, configure and populate OpenLDAP: see at <link xl:href="http://www.openldap.org">the OpenLDAP web site</link>.
</para>
</section>
<section>
<title>Web Application Security Mapping</title>
<para>
Every web application you need to use LDAP (single sign on) feature, you need to change the event's path of some the security request mappings to org.ofbiz.ldap.LdapLoginWorker class.
</para>
<section>
<title>checkLogin</title>
<para>
<programlisting>
<request-map uri="checkLogin" edit="false">
<description>Verify a user is logged in.</description>
<security https="true" auth="false"/>
<event type="java" path="org.ofbiz.ldap.LdapLoginWorker" invoke="checkLogin"/>
<response name="success" type="view" value="main"/>
<response name="error" type="view" value="login"/>
</request-map>
</programlisting>
</para>
</section>
<section>
<title>login</title>
<para>
<programlisting>
<request-map uri="login">
<security https="true" auth="false"/>
<event type="java" path="org.ofbiz.ldap.LdapLoginWorker" invoke="login"/>
<response name="success" type="view" value="main"/>
<response name="requirePasswordChange" type="view" value="requirePasswordChange"/>
<response name="error" type="view" value="login"/>
</request-map>
</programlisting>
</para>
</section>
<section>
<title>logout</title>
<para>
<programlisting>
<request-map uri="logout">
<security https="true" auth="true"/>
<event type="java" path="org.ofbiz.ldap.LdapLoginWorker" invoke="logout"/>
<response name="success" type="request-redirect" value="main"/>
<response name="error" type="view" value="main"/>
</request-map>
</programlisting>
</para>
</section>
</section>
</chapter>