forked from liferay/liferay-portal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-test-authentication.xml
256 lines (218 loc) · 7.63 KB
/
build-test-authentication.xml
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
<?xml version="1.0"?>
<project basedir="." name="portal-test-authentication" xmlns:antelope="antlib:ise.antelope.tasks">
<import file="build-test.xml" />
<macrodef name="deploy-cas">
<sequential>
<delete dir="${app.server.deploy.dir}/cas-web" />
<if>
<not>
<available file="${app.server.dir}/cas-web.war" />
</not>
<then>
<mirrors-get
dest="${app.server.dir}/cas-web.war"
src="http://files.liferay.com/private/apps/jasig/cas/3.3.5/cas-web.war"
verbose="true"
/>
<move
file="${app.server.dir}/cas-web.war"
tofile="${app.server.deploy.dir}/cas-web.war"
/>
</then>
</if>
<unzip
dest="${app.server.deploy.dir}/cas-web"
src="${app.server.deploy.dir}/cas-web.war"
/>
<delete dir="${app.server.deploy.dir}/cas-web.war" />
<echo file="${app.server.deploy.dir}/cas-web/META-INF/context.xml"><![CDATA[<Context>
<JarScanner>
<JarScanFilter className="com.liferay.support.tomcat.util.scan.LiferayJarScanFilter" pluggabilityScan="*" pluggabilitySkip="" tldScan="*" tldSkip="" />
</JarScanner>
</Context>]]></echo>
<replace
file="${app.server.deploy.dir}/cas-web/WEB-INF/deployerConfigContext.xml"
>
<replacetoken><![CDATA[<entry key="uid" value="uid" />]]></replacetoken>
<replacevalue><![CDATA[<entry key="uid"><list><value>uid</value></list></entry>]]></replacevalue>
</replace>
<replace
file="${app.server.deploy.dir}/cas-web/WEB-INF/deployerConfigContext.xml"
>
<replacetoken><![CDATA[<entry key="eduPersonAffiliation" value="eduPersonAffiliation" />]]></replacetoken>
<replacevalue><![CDATA[<entry key="eduPersonAffiliation"><list><value>eduPersonAffiliation</value></list></entry>]]></replacevalue>
</replace>
<replace
file="${app.server.deploy.dir}/cas-web/WEB-INF/deployerConfigContext.xml"
>
<replacetoken><![CDATA[<entry key="groupMembership" value="groupMembership" />]]></replacetoken>
<replacevalue><![CDATA[<entry key="groupMembership"><list><value>groupMembership</value></list></entry>]]></replacevalue>
</replace>
</sequential>
</macrodef>
<macrodef name="deploy-openam">
<sequential>
<delete dir="${app.server.deploy.dir}/openam" />
<if>
<not>
<available file="${app.server.dir}/openam.war" />
</not>
<then>
<mirrors-get
dest="${app.server.dir}/${openam.war.name}"
src="http://files.liferay.com/private/apps/forgerock/openam/${openam.war.name}"
verbose="true"
/>
<move
file="${app.server.dir}/${openam.war.name}"
tofile="${app.server.deploy.dir}/openam.war"
/>
</then>
</if>
</sequential>
</macrodef>
<macrodef name="unzip-openam-admin-tools">
<sequential>
<delete dir="${openam.admin.tools.dir}" />
<if>
<not>
<available file="${app.server.parent.dir}/${openam.admin.tools.zip.name}" />
</not>
<then>
<mirrors-get
dest="${app.server.parent.dir}/${openam.admin.tools.zip.name}"
src="http://files.liferay.com/private/apps/forgerock/openam/${openam.admin.tools.zip.name}"
verbose="true"
/>
</then>
</if>
<unzip
dest="${openam.admin.tools.dir}"
src="${app.server.parent.dir}/${openam.admin.tools.zip.name}"
/>
</sequential>
</macrodef>
<macrodef name="unzip-openam-configurator-tools">
<sequential>
<delete dir="${openam.configurator.tools.dir}" />
<if>
<not>
<available file="${app.server.parent.dir}/${openam.configurator.tools.zip.name}" />
</not>
<then>
<mirrors-get
dest="${app.server.parent.dir}/${openam.configurator.tools.zip.name}"
src="http://files.liferay.com/private/apps/forgerock/openam/${openam.configurator.tools.zip.name}"
verbose="true"
/>
</then>
</if>
<unzip
dest="${openam.configurator.tools.dir}"
src="${app.server.parent.dir}/${openam.configurator.tools.zip.name}"
/>
</sequential>
</macrodef>
<target name="delete-openam-config">
<delete dir="${openam.config.dir}" />
</target>
<target name="run-openam-tools">
<sequential>
<echo file="${openam.configurator.tools.dir}/config.properties">ACCEPT_LICENSES=true
ADMIN_PWD=password
AM_ENC_KEY=
AMLDAPUSERPASSWD=liferay01
BASE_DIR=${openam.config.dir}
COOKIE_DOMAIN=.able.com
DATA_STORE=embedded
DEPLOYMENT_URI=/openam
DIRECTORY_ADMIN_PORT=4444
DIRECTORY_JMX_PORT=1689
DIRECTORY_PORT=50389
DIRECTORY_SERVER=test.able.com
DIRECTORY_SSL=SIMPLE
DS_DIRMGRDN=cn=Directory Manager
DS_DIRMGRPASSWD=11111111
locale=en_US
PLATFORM_LOCALE=en_US
ROOT_SUFFIX=dc=openam,dc=forgerock,dc=org
SERVER_URL=http://test.able.com:8080</echo>
<java
failonerror="true"
fork="true"
jar="${openam.configurator.tools.dir}/openam-configurator-tool-${openam.version}.jar"
>
<arg line="--file ${openam.configurator.tools.dir}/config.properties" />
</java>
<echo file="${openam.admin.tools.dir}/datafile">com.iplanet.am.cookie.encode=true</echo>
<echo file="${openam.admin.tools.dir}/passwordfile">password</echo>
<if>
<os family="unix" />
<then>
<chmod
file="${openam.admin.tools.dir}/**"
perm="a+x"
/>
<exec dir="${openam.admin.tools.dir}" executable="/bin/bash" failonerror="true">
<arg value="-c" />
<arg value="./setup -p ${openam.config.dir} -d ${openam.admin.tools.dir}/debug -l ${openam.admin.tools.dir}/log --acceptLicense" />
</exec>
<chmod
file="${openam.admin.tools.dir}/passwordfile"
perm="400"
/>
<exec dir="${openam.admin.tools.dir}/openam/bin" executable="/bin/bash" failonerror="true">
<arg value="-c" />
<arg value="./ssoadm update-server-cfg -u amAdmin -f ${openam.admin.tools.dir}/passwordfile -D ${openam.admin.tools.dir}/datafile -s http://test.able.com:8080/openam" />
</exec>
<exec dir="${openam.admin.tools.dir}/openam/bin" executable="/bin/bash" failonerror="true">
<arg value="-c" />
<arg value="./ssoadm create-identity -e / -i 'test' -t User -u amAdmin -f ${openam.admin.tools.dir}/passwordfile -a givenName=Test sn=Test userPassword=password [email protected]" />
</exec>
</then>
<elseif>
<os family="windows" />
<then>
<exec dir="${openam.admin.tools.dir}" executable="cmd" failonerror="true">
<arg value="/c" />
<arg value="setup.bat -p ${openam.config.dir} -d ${openam.admin.tools.dir}/debug -l ${openam.admin.tools.dir}/log --acceptLicense" />
</exec>
<exec dir="${openam.admin.tools.dir}/openam/bin" executable="cmd" failonerror="true">
<arg value="/c" />
<arg value="ssoadm update-server-cfg -u amAdmin -f ${openam.admin.tools.dir}/passwordfile -D ${openam.admin.tools.dir}/datafile -s http://test.able.com:8080/openam" />
</exec>
<exec dir="${openam.admin.tools.dir}/openam/bin" executable="cmd" failonerror="true">
<arg value="/c" />
<arg value="ssoadm create-identity -e / -i 'Test Test' -t User -u amAdmin -f ${openam.admin.tools.dir}/passwordfile -a givenName=Test sn=Test userPassword=password [email protected]" />
</exec>
</then>
</elseif>
</if>
</sequential>
</target>
<target name="setup-cas">
<deploy-cas />
</target>
<target name="setup-openam">
<deploy-openam />
<unzip-openam-admin-tools />
<unzip-openam-configurator-tools />
</target>
<target name="verify-token-based-login">
<exec executable="curl" outputproperty="curl.output">
<arg line="-H SM_USER:${user.token} ${portal.url}" />
</exec>
<echo>${curl.output}</echo>
<if>
<not>
<contains string="${curl.output}" substring="Sign In" />
</not>
<then>
<echo>Signed in successfully.</echo>
</then>
<else>
<fail>Token-based SSO failed.</fail>
</else>
</if>
</target>
</project>