org.codehaus.groovy.grails.plugins.springsecurity
Class IpAddressFilter

java.lang.Object
  extended by org.springframework.security.ui.SpringSecurityFilter
      extended by org.codehaus.groovy.grails.plugins.springsecurity.IpAddressFilter
All Implemented Interfaces:
javax.servlet.Filter, org.springframework.beans.factory.InitializingBean, org.springframework.core.Ordered

public class IpAddressFilter
extends org.springframework.security.ui.SpringSecurityFilter
implements org.springframework.beans.factory.InitializingBean

Blocks access to protected resources based on IP address. Sends 404 rather than reporting error to hide visibility of the resources.
Supports either Ant-style patterns (e.g. 10.**) or masked patterns (e.g. 192.168.1.0/24 or 202.24.0.0/14).

Author:
Burt Beckwith

Field Summary
 
Fields inherited from class org.springframework.security.ui.SpringSecurityFilter
logger
 
Fields inherited from interface org.springframework.core.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
 
Constructor Summary
IpAddressFilter()
           
 
Method Summary
 void afterPropertiesSet()
          
protected  void doFilterHttp(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, javax.servlet.FilterChain chain)
          
 int getOrder()
          
 void setIpRestrictions(Map<String,String> restrictions)
          Dependency injection for the ip/pattern restriction map.
 
Methods inherited from class org.springframework.security.ui.SpringSecurityFilter
destroy, doFilter, init, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IpAddressFilter

public IpAddressFilter()
Method Detail

doFilterHttp

protected void doFilterHttp(javax.servlet.http.HttpServletRequest request,
                            javax.servlet.http.HttpServletResponse response,
                            javax.servlet.FilterChain chain)
                     throws IOException,
                            javax.servlet.ServletException

Specified by:
doFilterHttp in class org.springframework.security.ui.SpringSecurityFilter
Throws:
IOException
javax.servlet.ServletException
See Also:
SpringSecurityFilter.doFilterHttp( javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, javax.servlet.FilterChain)

getOrder

public int getOrder()

Specified by:
getOrder in interface org.springframework.core.Ordered
See Also:
Ordered.getOrder()

afterPropertiesSet

public void afterPropertiesSet()

Specified by:
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
See Also:
InitializingBean.afterPropertiesSet()

setIpRestrictions

public void setIpRestrictions(Map<String,String> restrictions)
Dependency injection for the ip/pattern restriction map.

Parameters:
restrictions - the map