1 13 package info.magnolia.cms.security; 14 15 import java.util.Map ; 16 17 import javax.servlet.http.HttpServletRequest ; 18 19 20 26 public final class Listener { 27 28 31 private Listener() { 32 } 34 35 39 public static boolean isAllowed(HttpServletRequest req) { 40 if (Listener.isIPAllowed(req)) { 41 return true; 42 } 43 return false; 44 } 45 46 50 private static boolean isIPAllowed(HttpServletRequest req) { 51 try { 52 Map access = info.magnolia.cms.beans.config.Listener.getInfo(req.getRemoteAddr()); 53 return (access.get(req.getMethod().toLowerCase()) != null); 54 } 55 catch (Exception e) { 56 } 57 try { 58 59 Map access = info.magnolia.cms.beans.config.Listener.getInfo("*"); return (access.get(req.getMethod().toLowerCase()) != null); 61 } 62 catch (Exception e) { 63 return false; 64 } 65 } 66 } 67 | Popular Tags |