Skip to Content.
Sympa Menu

perfsonar-dev - perfsonar: r3514 - in trunk/surfnet_java-flowsa-ma/conf/axis-1.4/WEB-INF: . classes/nl/surfnet/web

Subject: perfsonar development work

List archive

perfsonar: r3514 - in trunk/surfnet_java-flowsa-ma/conf/axis-1.4/WEB-INF: . classes/nl/surfnet/web


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r3514 - in trunk/surfnet_java-flowsa-ma/conf/axis-1.4/WEB-INF: . classes/nl/surfnet/web
  • Date: Thu, 13 Mar 2008 11:43:43 -0400

Author: michael.bischoff
Date: 2008-03-13 11:43:41 -0400 (Thu, 13 Mar 2008)
New Revision: 3514

Modified:

trunk/surfnet_java-flowsa-ma/conf/axis-1.4/WEB-INF/classes/nl/surfnet/web/IpAccessFilter.class

trunk/surfnet_java-flowsa-ma/conf/axis-1.4/WEB-INF/classes/nl/surfnet/web/IpAccessFilter.java
trunk/surfnet_java-flowsa-ma/conf/axis-1.4/WEB-INF/web.xml
Log:
Added support for ip ranges to the filter

Modified:
trunk/surfnet_java-flowsa-ma/conf/axis-1.4/WEB-INF/classes/nl/surfnet/web/IpAccessFilter.class
===================================================================
(Binary files differ)

Modified:
trunk/surfnet_java-flowsa-ma/conf/axis-1.4/WEB-INF/classes/nl/surfnet/web/IpAccessFilter.java
===================================================================
---
trunk/surfnet_java-flowsa-ma/conf/axis-1.4/WEB-INF/classes/nl/surfnet/web/IpAccessFilter.java
2008-03-13 12:37:03 UTC (rev 3513)
+++
trunk/surfnet_java-flowsa-ma/conf/axis-1.4/WEB-INF/classes/nl/surfnet/web/IpAccessFilter.java
2008-03-13 15:43:41 UTC (rev 3514)
@@ -60,13 +60,7 @@

String[] ips = ipsParameter.split(" ");

- boolean allowed = false;
- for (String ip : ips) {
- if (ip.equals(remoteIp)) {
- allowed = true;
- break;
- }
- }
+ boolean allowed = isAllowed(remoteIp, ips);

if (!allowed) {
if (response instanceof HttpServletResponse) {
@@ -97,6 +91,19 @@
}
}

+ private boolean isAllowed(String remoteIp, String[] ips) {
+ for (String ip : ips) {
+ if(ip.contains("*")) {
+ if(remoteIp.startsWith(ip.split("\\*")[0])) {
+ return true;
+ }
+ } else if (remoteIp.equals(ip)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
/**
* Return the filter configuration object for this filter.
*/

Modified: trunk/surfnet_java-flowsa-ma/conf/axis-1.4/WEB-INF/web.xml
===================================================================
--- trunk/surfnet_java-flowsa-ma/conf/axis-1.4/WEB-INF/web.xml 2008-03-13
12:37:03 UTC (rev 3513)
+++ trunk/surfnet_java-flowsa-ma/conf/axis-1.4/WEB-INF/web.xml 2008-03-13
15:43:41 UTC (rev 3514)
@@ -11,7 +11,7 @@
<filter-class>nl.surfnet.web.IpAccessFilter</filter-class>
<init-param>
<param-name>ips</param-name>
- <param-value>127.0.0.1
2001:610:508:109:20b:dbff:fee9:61f3 62.131.17.150 192.87.109.151
192.87.109.84 192.87.102.208 78.27.8.39 192.87.117.149
192.87.109.186</param-value>
+ <param-value>127.0.0.1
2001:610:508:109:20b:dbff:fee9:61f3 62.131.17.150 78.27.8.39 192.87.102.*
192.87.109.* 192.87.117.* </param-value>
<description>
A space separated list of ips that are
allowed to access
resources.



  • perfsonar: r3514 - in trunk/surfnet_java-flowsa-ma/conf/axis-1.4/WEB-INF: . classes/nl/surfnet/web, svnlog, 03/13/2008

Archive powered by MHonArc 2.6.16.

Top of Page