ch.elca.el4j.services.security.filters
Class IPAddressFilter

java.lang.Object
  extended by ch.elca.el4j.services.security.filters.IPAddressFilter
All Implemented Interfaces:
javax.servlet.Filter

public class IPAddressFilter
extends Object
implements javax.servlet.Filter

Blocks requests from unauthorized IP addresses. It answers with the 401 (Unauthorized) status code if the IP is not authorized. Authorized IPs are forwarded directly.

The list of authorized IP addresses are read from a configurable system property or env property, if the system property is not defined. The format is x1.y1.z1.w1[,x2.y2.z2.w2] whereas * can be used to match any character sequence.

Configuration:

 <filter>
     <filter-name>IP Adress Filter</filter-name>
     <filter-class>ch.elca.el4j.services.security.filters.IPAddressFilter</filter-class>
     <init-param>
         <param-name>ipAddresses</param-name>
         <param-value>operation.ipAddresses</param-value>
     </init-param>
 </filter>
 

Author:
Fabian Reichlin (FRE), Laurent Bovet (LBO)
File-location:
IPAddressFilter
Last check-in date:
2009-08-04 15:06:35 +0200 (Di, 04. Aug 2009) by swismer for revision 3878

Field Summary
static String PROPERTY_PARAM_NAME
           
static String WILDCARD
           
 
Constructor Summary
IPAddressFilter()
           
 
Method Summary
 void destroy()
          
 void doFilter(javax.servlet.ServletRequest request, javax.servlet.ServletResponse response, javax.servlet.FilterChain chain)
          
 void init(javax.servlet.FilterConfig config)
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_PARAM_NAME

public static final String PROPERTY_PARAM_NAME
See Also:
Constant Field Values

WILDCARD

public static final String WILDCARD
See Also:
Constant Field Values
Constructor Detail

IPAddressFilter

public IPAddressFilter()
Method Detail

init

public void init(javax.servlet.FilterConfig config)
          throws javax.servlet.ServletException

Specified by:
init in interface javax.servlet.Filter
Throws:
javax.servlet.ServletException

doFilter

public void doFilter(javax.servlet.ServletRequest request,
                     javax.servlet.ServletResponse response,
                     javax.servlet.FilterChain chain)
              throws IOException,
                     javax.servlet.ServletException

Specified by:
doFilter in interface javax.servlet.Filter
Throws:
IOException
javax.servlet.ServletException

destroy

public void destroy()

Specified by:
destroy in interface javax.servlet.Filter


Copyright © 2005-2011 ELCA. All Rights Reserved.