diff --git a/hsarweb/build.xml b/hsarweb/build.xml
index 530142d..eaad198 100644
--- a/hsarweb/build.xml
+++ b/hsarweb/build.xml
@@ -21,6 +21,7 @@
+
@@ -38,4 +39,9 @@
/>
+
+
+
+
+
diff --git a/hsarweb/conf/WEB-INF/web.xml b/hsarweb/conf/WEB-INF/web.xml
index efabea9..e9a46ec 100644
--- a/hsarweb/conf/WEB-INF/web.xml
+++ b/hsarweb/conf/WEB-INF/web.xml
@@ -7,15 +7,15 @@
serverName
- https://@ADMIN_HOST@:@ADMIN_PORT@
+ @HTTPS@://@ADMIN_HOST@:@ADMIN_PORT@
backendURL
- https://@CONFIG_HOST@:@CONFIG_PORT@/hsar/backend
+ @HTTPS@://@CONFIG_HOST@:@CONFIG_PORT@/hsar/backend
xmlrpcURL
- https://@CONFIG_HOST@:@CONFIG_PORT@/hsar/xmlrpc/hsadmin
+ @HTTPS@://@CONFIG_HOST@:@CONFIG_PORT@/hsar/xmlrpc/hsadmin
Vaadin production mode
@@ -28,11 +28,11 @@
org.jasig.cas.client.authentication.AuthenticationFilter
casServerLoginUrl
- https://@LOGIN_HOST@:@LOGIN_PORT@/cas/login
+ @HTTPS@://@LOGIN_HOST@:@LOGIN_PORT@/cas/login
service
- https://@ADMIN_HOST@:@ADMIN_PORT@/hsarweb
+ @HTTPS@://@ADMIN_HOST@:@ADMIN_PORT@/hsarweb
@@ -41,7 +41,7 @@
org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter
casServerUrlPrefix
- https://@LOGIN_HOST@:@LOGIN_PORT@/cas
+ @HTTPS@://@LOGIN_HOST@:@LOGIN_PORT@/cas
proxyReceptorUrl
@@ -49,11 +49,11 @@
proxyCallbackUrl
- https://@ADMIN_HOST@:@ADMIN_PORT@/hsarweb/proxyCallback
+ @HTTPS@://@ADMIN_HOST@:@ADMIN_PORT@/hsarweb/proxyCallback
service
- https://@ADMIN_HOST@:@ADMIN_PORT@/hsarweb
+ @HTTPS@://@ADMIN_HOST@:@ADMIN_PORT@/hsarweb
@@ -66,13 +66,13 @@
CAS Authentication Filter
/*
-
+
Logout Servlet
de.hsadmin.logout.LogoutServlet
redirect
- https://@LOGIN_HOST@:@LOGIN_PORT@/cas/logout
+ @HTTPS@://@LOGIN_HOST@:@LOGIN_PORT@/cas/logout
diff --git a/hsarweb/src/de/hsadmin/web/Config.java b/hsarweb/src/de/hsadmin/web/Config.java
new file mode 100644
index 0000000..83ef15d
--- /dev/null
+++ b/hsarweb/src/de/hsadmin/web/Config.java
@@ -0,0 +1,57 @@
+package de.hsadmin.web;
+
+import java.io.File;
+import java.io.FileReader;
+import java.util.Properties;
+
+public class Config {
+
+ private static Config instance;
+
+ private Properties props;
+
+ private Config() {
+ props = new Properties();
+ File file = new File(System.getProperty("user.dir") + "/hsadmin.properties");
+ if (!file.canRead()) {
+ file = new File(System.getProperty("user.dir") + "/conf/hsadmin.properties");
+ }
+ if (!file.canRead()) {
+ file = new File(System.getProperty("user.home") + "/.hsadmin.properties");
+ }
+ if (!file.canRead()) {
+ file = new File("/etc/hsadmin.properties");
+ }
+ if (!file.canRead()) {
+ file = new File("/etc/hsadmin/hsadmin.properties");
+ }
+ if (file.canRead()) {
+ try {
+ props.load(new FileReader(file));
+ } catch (Exception e) {
+ // should not happen
+ e.printStackTrace();
+ }
+ }
+ }
+
+ public static Config getInstance() {
+ if (instance == null) {
+ instance = new Config();
+ }
+ return instance;
+ }
+
+ public String getProperty(String propertyName) {
+ String property = props.getProperty(propertyName);
+ if (property == null) {
+ return null;
+ }
+ return property.trim();
+ }
+
+ public String getProperty(String propertyName, String defaultValue) {
+ return props.getProperty(propertyName, defaultValue).trim();
+ }
+
+}
diff --git a/hsarweb/src/de/hsadmin/web/MainApplication.java b/hsarweb/src/de/hsadmin/web/MainApplication.java
index 5f256a2..9d87716 100644
--- a/hsarweb/src/de/hsadmin/web/MainApplication.java
+++ b/hsarweb/src/de/hsadmin/web/MainApplication.java
@@ -32,6 +32,14 @@ import de.hsadmin.web.config.ModuleConfig;
public class MainApplication extends Application implements HttpServletRequestListener, TabSheet.SelectedTabChangeListener {
private static final long serialVersionUID = 1L;
+ private static final String LOGIN_URL = "https://login.hostsharing.net:443/cas/v1/tickets";
+ private static boolean isTestEnvironment = false;
+
+ static {
+ Config config = Config.getInstance();
+ Object loginURL = config.getProperty("loginURL", LOGIN_URL);
+ isTestEnvironment = "TestUmgebung".equals(loginURL);
+ }
private HttpSession httpSession;
private ServletContext servletContext;
@@ -138,7 +146,26 @@ public class MainApplication extends Application implements HttpServletRequestLi
requestLocale = request.getLocale();
httpSession = request.getSession();
servletContext = httpSession.getServletContext();
- userPrincipal = ((Assertion) httpSession.getAttribute(AuthenticationFilter.CONST_CAS_ASSERTION)).getPrincipal();
+ if (isTestEnvironment) {
+ userPrincipal = new AttributePrincipal() {
+ private static final long serialVersionUID = 1L;
+ @Override
+ public String getName() {
+ return "ad";
+ }
+ @Override
+ public String getProxyTicketFor(String arg0) {
+ return "user:ad";
+ }
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Map getAttributes() {
+ return new HashMap();
+ }
+ };
+ } else {
+ userPrincipal = ((Assertion) httpSession.getAttribute(AuthenticationFilter.CONST_CAS_ASSERTION)).getPrincipal();
+ }
}
@Override