|
From: <pe...@us...> - 2003-12-15 14:38:26
|
Update of /cvsroot/neuclear/neuclear-commons/src/java/org/neuclear/commons/servlets
In directory sc8-pr-cvs1:/tmp/cvs-serv5302/src/java/org/neuclear/commons/servlets
Added Files:
EnsureRequestHostFilter.java
Log Message:
Added EnsureHostRequestFilter to commons, to only allow requests from a particular IP
Added a method to optionally show the passphrase box in the SigningServlet. As the default SigningServlet
is intended to be used with a gui passphrase agent, we dont want to display it.
The DemoSigningServlet does display the dialogue.
Added the new neuclear-signer package, which is a standalone web signer using Jetty. The project runs
when built with "maven javaapp". More testing needs to be done as well as a startup wizard.
--- NEW FILE: EnsureRequestHostFilter.java ---
package org.neuclear.commons.servlets;
import org.neuclear.commons.Utility;
import javax.servlet.*;
import java.io.IOException;
/**
* Filter that only allows requests from the given ip address. Defaults to 127.0.0.1 (localhost).
* This can be set in the init parameter <tt>allowip</tt>
*/
public class EnsureRequestHostFilter implements Filter{
public void init(FilterConfig config) throws ServletException {
allowed=Utility.denullString(config.getInitParameter("allowip"),"127.0.0.1");
}
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
if (request.getRemoteAddr().equals(allowed))
chain.doFilter(request, response);
}
public void destroy() {
}
private String allowed;
}
|