local testing without https

This commit is contained in:
Peter Hormanns 2012-10-18 13:59:05 +02:00
parent 75ea95b74f
commit e0f98d7d3b
3 changed files with 44 additions and 11 deletions

View File

@ -21,6 +21,7 @@
<filter token="CONFIG_PORT" value="${hsar.https.port}"/> <filter token="CONFIG_PORT" value="${hsar.https.port}"/>
<filter token="ADMIN_HOST" value="${hsarweb.domain.name}"/> <filter token="ADMIN_HOST" value="${hsarweb.domain.name}"/>
<filter token="ADMIN_PORT" value="${hsarweb.https.port}"/> <filter token="ADMIN_PORT" value="${hsarweb.https.port}"/>
<filter token="HTTPS" value="${hsar.https}"/>
</filterset> </filterset>
</copy> </copy>
<war destfile="build/hsarweb.war" basedir="WebContent"> <war destfile="build/hsarweb.war" basedir="WebContent">
@ -38,4 +39,9 @@
/> />
</target> </target>
<target name="clean">
<delete dir="build"/>
<delete file="WebContent/WEB-INF/web.xml"/>
</target>
</project> </project>

View File

@ -7,15 +7,15 @@
<context-param> <context-param>
<param-name>serverName</param-name> <param-name>serverName</param-name>
<param-value>https://@ADMIN_HOST@:@ADMIN_PORT@</param-value> <param-value>@HTTPS@://@ADMIN_HOST@:@ADMIN_PORT@</param-value>
</context-param> </context-param>
<context-param> <context-param>
<param-name>backendURL</param-name> <param-name>backendURL</param-name>
<param-value>https://@CONFIG_HOST@:@CONFIG_PORT@/hsar/backend</param-value> <param-value>@HTTPS@://@CONFIG_HOST@:@CONFIG_PORT@/hsar/backend</param-value>
</context-param> </context-param>
<context-param> <context-param>
<param-name>xmlrpcURL</param-name> <param-name>xmlrpcURL</param-name>
<param-value>https://@CONFIG_HOST@:@CONFIG_PORT@/hsar/xmlrpc/hsadmin</param-value> <param-value>@HTTPS@://@CONFIG_HOST@:@CONFIG_PORT@/hsar/xmlrpc/hsadmin</param-value>
</context-param> </context-param>
<context-param> <context-param>
<description>Vaadin production mode</description> <description>Vaadin production mode</description>
@ -28,11 +28,11 @@
<filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class> <filter-class>org.jasig.cas.client.authentication.AuthenticationFilter</filter-class>
<init-param> <init-param>
<param-name>casServerLoginUrl</param-name> <param-name>casServerLoginUrl</param-name>
<param-value>https://@LOGIN_HOST@:@LOGIN_PORT@/cas/login</param-value> <param-value>@HTTPS@://@LOGIN_HOST@:@LOGIN_PORT@/cas/login</param-value>
</init-param> </init-param>
<init-param> <init-param>
<param-name>service</param-name> <param-name>service</param-name>
<param-value>https://@ADMIN_HOST@:@ADMIN_PORT@/hsarweb</param-value> <param-value>@HTTPS@://@ADMIN_HOST@:@ADMIN_PORT@/hsarweb</param-value>
</init-param> </init-param>
</filter> </filter>
@ -41,7 +41,7 @@
<filter-class>org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter</filter-class> <filter-class>org.jasig.cas.client.validation.Cas20ProxyReceivingTicketValidationFilter</filter-class>
<init-param> <init-param>
<param-name>casServerUrlPrefix</param-name> <param-name>casServerUrlPrefix</param-name>
<param-value>https://@LOGIN_HOST@:@LOGIN_PORT@/cas</param-value> <param-value>@HTTPS@://@LOGIN_HOST@:@LOGIN_PORT@/cas</param-value>
</init-param> </init-param>
<init-param> <init-param>
<param-name>proxyReceptorUrl</param-name> <param-name>proxyReceptorUrl</param-name>
@ -49,11 +49,11 @@
</init-param> </init-param>
<init-param> <init-param>
<param-name>proxyCallbackUrl</param-name> <param-name>proxyCallbackUrl</param-name>
<param-value>https://@ADMIN_HOST@:@ADMIN_PORT@/hsarweb/proxyCallback</param-value> <param-value>@HTTPS@://@ADMIN_HOST@:@ADMIN_PORT@/hsarweb/proxyCallback</param-value>
</init-param> </init-param>
<init-param> <init-param>
<param-name>service</param-name> <param-name>service</param-name>
<param-value>https://@ADMIN_HOST@:@ADMIN_PORT@/hsarweb</param-value> <param-value>@HTTPS@://@ADMIN_HOST@:@ADMIN_PORT@/hsarweb</param-value>
</init-param> </init-param>
</filter> </filter>
@ -72,7 +72,7 @@
<servlet-class>de.hsadmin.logout.LogoutServlet</servlet-class> <servlet-class>de.hsadmin.logout.LogoutServlet</servlet-class>
<init-param> <init-param>
<param-name>redirect</param-name> <param-name>redirect</param-name>
<param-value>https://@LOGIN_HOST@:@LOGIN_PORT@/cas/logout</param-value> <param-value>@HTTPS@://@LOGIN_HOST@:@LOGIN_PORT@/cas/logout</param-value>
</init-param> </init-param>
</servlet> </servlet>

View File

@ -32,6 +32,14 @@ import de.hsadmin.web.config.ModuleConfig;
public class MainApplication extends Application implements HttpServletRequestListener, TabSheet.SelectedTabChangeListener { public class MainApplication extends Application implements HttpServletRequestListener, TabSheet.SelectedTabChangeListener {
private static final long serialVersionUID = 1L; 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 HttpSession httpSession;
private ServletContext servletContext; private ServletContext servletContext;
@ -138,8 +146,27 @@ public class MainApplication extends Application implements HttpServletRequestLi
requestLocale = request.getLocale(); requestLocale = request.getLocale();
httpSession = request.getSession(); httpSession = request.getSession();
servletContext = httpSession.getServletContext(); servletContext = httpSession.getServletContext();
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(); userPrincipal = ((Assertion) httpSession.getAttribute(AuthenticationFilter.CONST_CAS_ASSERTION)).getPrincipal();
} }
}
@Override @Override
public void onRequestEnd(HttpServletRequest request, public void onRequestEnd(HttpServletRequest request,