Secure whole application [message #1219082] |
Sun, 01 December 2013 09:29  |
Eclipse User |
|
|
|
I would like to make my RAP application and transport only accessible by https. I would like to use the feature in the servlet spec transport guarantee Confidential. Then jetty (paxweb) should automatically redirect any http requests to https. Possible ? or am I going at this the wrong way..
|
|
|
|
|
|
Re: Secure whole application [message #1220135 is a reply to message #1219727] |
Mon, 09 December 2013 22:27   |
Eclipse User |
|
|
|
We that still does not work because regardless of the HttpConext you pass in to
ApplicationLauncher.launch you wrap it up in a HttpContextWrapper and therefore it is not the same HttpContext. The hack I used to make it work (very ugly)....
ApplicationReference ref = applicationLauncher.launch(this, httpService, null, null, System.getProperty("java.io.tmpdir"));
Field f = ref.getClass().getDeclaredField("httpContext");
f.setAccessible(true);
HttpContext ctx = (HttpContext) f.get(ref);
org.ops4j.pax.web.service.WebContainer.WebContainer container = bundleContext.getService(bundleContext.getServiceReference(WebContainer.class));
container.registerFilter(new HttpToHttpsFilter(), new String [] { "/portal" , "/portal/*"}, null, null, ctx);
Basically I am grabbing the wrapped context and then manually registering the filter against it.I would suggest ApplicationReference expose a getHttpContext() method or event better expose it farther down in the Application interface so it could be called when in the ApplicationConfiguration.configure().
|
|
|
|
Powered by
FUDForum. Page generated in 0.04889 seconds