Revision 2dbf7d4f
Added by Andreas Kohlbecker about 13 years ago
pom.xml | ||
---|---|---|
25 | 25 |
${project.fullversionstring} is being used by some build plugins |
26 | 26 |
--> |
27 | 27 |
<project.fullversionstring>${project.version}.${project.patchversion}.${maven.build.timestamp}</project.fullversionstring> |
28 |
<jetty-version>7.0.1.v20091125</jetty-version>
|
|
28 |
<jetty-version>7.2.2.v20101205</jetty-version>
|
|
29 | 29 |
</properties> |
30 | 30 |
|
31 | 31 |
<scm> |
... | ... | |
440 | 440 |
<artifactId>jetty-jmx</artifactId> |
441 | 441 |
<version>${jetty-version}</version> |
442 | 442 |
</dependency> |
443 |
<dependency> |
|
444 |
<groupId>org.eclipse.jetty</groupId> |
|
445 |
<artifactId>jetty-security</artifactId> |
|
446 |
<version>${jetty-version}</version> |
|
447 |
</dependency> |
|
443 | 448 |
<dependency> |
444 | 449 |
<groupId>org.mortbay.jetty</groupId> |
445 | 450 |
<artifactId>jsp-2.1-glassfish</artifactId> |
... | ... | |
450 | 455 |
<artifactId>jta</artifactId> |
451 | 456 |
<version>1.1</version> |
452 | 457 |
</dependency> |
453 |
|
|
458 |
<!-- JSON --> |
|
459 |
<dependency> |
|
460 |
<groupId>org.codehaus.jackson</groupId> |
|
461 |
<artifactId>jackson-mapper-asl</artifactId> |
|
462 |
<version>1.6.4</version> |
|
463 |
</dependency> |
|
454 | 464 |
<!-- windows service --> |
455 | 465 |
<dependency> |
456 | 466 |
<groupId>tanukisoft</groupId> |
src/main/installer/linux/postinst | ||
---|---|---|
17 | 17 |
SERVERSCRIPT="cdmserver" |
18 | 18 |
SERVERJAR="cdm-server.jar" |
19 | 19 |
SERVERCONF="datasources.xml" |
20 |
SERVERREALM="cdm-server-realm.properties" |
|
20 | 21 |
PROPERTIES="cdmserver.properties" |
21 | 22 |
|
22 | 23 |
CDM_USER=cdmuser |
... | ... | |
95 | 96 |
|
96 | 97 |
#installing the server and the configfile |
97 | 98 |
cp $TMP$SERVERCONF $CDM_LIBRARY |
99 |
cp $TMP$SERVERREALM $CDM_LIBRARY |
|
98 | 100 |
cp $TMP$SERVERJAR $CDM_HOME |
99 |
#cp $TMP$PROPERTIES $CDM_LIBRARY |
|
100 |
#mkdir -p /root/.cdmLibrary |
|
101 |
#cp $TMP$SERVERCONF /root/.cdmLibrary/ |
|
102 |
cp $TMP$SERVERCONF $CDM_LIBRARY |
|
103 | 101 |
|
104 | 102 |
#starting the script |
105 | 103 |
$bindir$SERVERSCRIPT start |
src/main/installer/templates/.cdmLibrary/cdm-server-realm.properties | ||
---|---|---|
11 | 11 |
# If DIGEST Authentication is used, the password must be in a recoverable |
12 | 12 |
# format, either plain text or OBF:. |
13 | 13 |
# |
14 |
# please refer to http://docs.codehaus.org/display/JETTY/Realms as reference |
|
15 |
# |
|
14 | 16 |
admin: edit,server-administrator,admin |
src/main/java/eu/etaxonomy/cdm/server/Bootloader.java | ||
---|---|---|
28 | 28 |
import java.net.URL; |
29 | 29 |
import java.sql.Connection; |
30 | 30 |
import java.sql.SQLException; |
31 |
import java.util.Enumeration; |
|
32 | 31 |
import java.util.List; |
33 | 32 |
import java.util.Set; |
34 | 33 |
|
... | ... | |
44 | 43 |
import org.apache.log4j.Logger; |
45 | 44 |
import org.apache.log4j.PatternLayout; |
46 | 45 |
import org.apache.log4j.RollingFileAppender; |
47 |
import org.apache.tools.ant.types.CommandlineJava.SysProperties; |
|
48 | 46 |
import org.eclipse.jetty.jmx.MBeanContainer; |
49 |
import org.eclipse.jetty.server.Handler;
|
|
47 |
import org.eclipse.jetty.security.HashLoginService;
|
|
50 | 48 |
import org.eclipse.jetty.server.Server; |
51 | 49 |
import org.eclipse.jetty.server.handler.ContextHandlerCollection; |
52 | 50 |
import org.eclipse.jetty.server.handler.ContextHandler.Context; |
... | ... | |
129 | 127 |
} catch (Exception e) { |
130 | 128 |
logger.error(e); |
131 | 129 |
} |
132 |
} |
|
130 |
}
|
|
133 | 131 |
} |
134 |
|
|
132 |
|
|
135 | 133 |
|
136 | 134 |
@Override |
137 | 135 |
public void lifeCycleFailure(LifeCycle event, Throwable cause) { |
... | ... | |
142 | 140 |
private static final Logger logger = Logger.getLogger(Bootloader.class); |
143 | 141 |
|
144 | 142 |
private static final String DATASOURCE_BEANDEF_FILE = "datasources.xml"; |
143 |
private static final String REALM_PROPERTIES_FILE = "cdm-server-realm.properties"; |
|
144 |
|
|
145 | 145 |
private static final String USERHOME_CDM_LIBRARY_PATH = System.getProperty("user.home")+File.separator+".cdmLibrary"+File.separator; |
146 | 146 |
private static final String TMP_PATH = USERHOME_CDM_LIBRARY_PATH + "server" + File.separator; |
147 | 147 |
private static final String LOG_PATH = USERHOME_CDM_LIBRARY_PATH + "log" + File.separator; |
... | ... | |
227 | 227 |
dsCass.getMethod("setJdbcUrl", new Class[] {String.class}).invoke(datasource, new Object[] {conf.getUrl()}); |
228 | 228 |
dsCass.getMethod("setUser", new Class[] {String.class}).invoke(datasource, new Object[] {conf.getUsername()}); |
229 | 229 |
dsCass.getMethod("setPassword", new Class[] {String.class}).invoke(datasource, new Object[] {conf.getPassword()}); |
230 |
|
|
230 |
|
|
231 | 231 |
Connection connection = null; |
232 | 232 |
String sqlerror = null; |
233 | 233 |
try { |
... | ... | |
432 | 432 |
// |
433 | 433 |
logger.info("preparing default WebAppContext"); |
434 | 434 |
WebAppContext defaultWebappContext = new WebAppContext(); |
435 |
|
|
435 | 436 |
setWebApp(defaultWebappContext, defaultWebAppFile); |
436 | 437 |
defaultWebappContext.setContextPath("/"); |
437 | 438 |
defaultWebappContext.setTempDirectory(DEFAULT_WEBAPP_TEMP_FOLDER); |
439 |
|
|
440 |
// configure security context |
|
441 |
// see for reference * http://docs.codehaus.org/display/JETTY/Realms |
|
442 |
// * http://wiki.eclipse.org/Jetty/Starting/Porting_to_Jetty_7 |
|
443 |
HashLoginService loginService = new HashLoginService(); |
|
444 |
loginService.setConfig(USERHOME_CDM_LIBRARY_PATH + REALM_PROPERTIES_FILE); |
|
445 |
defaultWebappContext.getSecurityHandler().setLoginService(loginService); |
|
446 |
|
|
438 | 447 |
// Important: |
439 | 448 |
// the defaultWebappContext MUST USE the super classloader |
440 | 449 |
// otherwise the status page (index.jsp) might not work |
src/main/resources/log4j.properties | ||
---|---|---|
20 | 20 |
## this is done in Bootloader.class for you |
21 | 21 |
## |
22 | 22 |
|
23 |
log4j.logger.eu.etaxonomy.cdm.server = DEBUG |
|
23 | 24 |
|
24 | 25 |
### |
25 | 26 |
# cdm |
src/main/webapp/WEB-INF/web.xml | ||
---|---|---|
6 | 6 |
<description>EDIT CDM Community Server</description> |
7 | 7 |
<display-name>CDM Community Server</display-name> |
8 | 8 |
|
9 |
<!-- ================================================================== |
|
9 |
<!-- |
|
10 |
================================================================== |
|
10 | 11 |
load /WEB-INF/applicationContext.xml |
11 | 12 |
|
12 | 13 |
org.springframework.web.context.ContextLoaderListener defaults |
13 | 14 |
to /WEB-INF/applicationContext.xml if contextConfigLocation |
14 | 15 |
not set |
15 |
================================================================== --> |
|
16 |
================================================================== |
|
17 |
--> |
|
16 | 18 |
<!-- |
17 | 19 |
--> |
18 | 20 |
|
... | ... | |
23 | 25 |
<welcome-file-list> |
24 | 26 |
<welcome-file>index.jsp</welcome-file> |
25 | 27 |
</welcome-file-list> |
28 |
|
|
29 |
<!-- |
|
30 |
=== Security Settings === |
|
31 |
--> |
|
32 |
<security-constraint> |
|
33 |
<web-resource-collection> |
|
34 |
<web-resource-name>CDM Server Management</web-resource-name> |
|
35 |
<url-pattern>/index.jsp</url-pattern> |
|
36 |
</web-resource-collection> |
|
37 |
<auth-constraint> |
|
38 |
<role-name>admin</role-name> |
|
39 |
</auth-constraint> |
|
40 |
</security-constraint> |
|
41 |
|
|
42 |
<login-config> |
|
43 |
<auth-method>BASIC</auth-method> |
|
44 |
<realm-name>CDMServer.management</realm-name> |
|
45 |
</login-config> |
|
46 |
|
|
47 |
|
|
26 | 48 |
|
27 | 49 |
</web-app> |
Also available in: Unified diff
admin pages secured