forked from liferay/liferay-portal
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-test-authentication.xml
182 lines (154 loc) · 5.57 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
<?xml version="1.0"?>
<project basedir="." name="portal-test-authentication" xmlns:antelope="antlib:ise.antelope.tasks">
<import file="build-test.xml" />
<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-12.0.0.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-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:[email protected] localhost:8080" />
</exec>
<echo>${curl.output}</echo>
<if>
<contains string="${curl.output}" substring="Test Test" />
<then>
<echo>Signed in successfully.</echo>
</then>
<else>
<fail>Token-based SSO failed.</fail>
</else>
</if>
</target>
</project>