@Test public void getClientIpWithUntrustedProxy() { configurationService.setProperty("useProxies", true); configurationService.setProperty("proxies.trusted.ipranges", "192.168.1.1"); clientInfoService = new ClientInfoServiceImpl(configurationService); String remoteIp = "10.24.64.14"; String xForwardedFor = "192.168.1.24"; assertEquals("10.24.64.14", clientInfoService.getClientIp(remoteIp, xForwardedFor)); }
@Override public String getClientIp(HttpServletRequest request) { return getClientIp(request.getRemoteAddr(), request.getHeader(X_FORWARDED_FOR_HEADER)); }
ClientInfoServiceImpl implements ClientInfoService { @Override public String getClientIp(HttpServletRequest request) { return getClientIp(request.getRemoteAddr(), request.getHeader(X_FORWARDED_FOR_HEADER)); } }
ClientInfoServiceImpl implements ClientInfoService { @Override public String getClientIp(HttpServletRequest request) { return getClientIp(request.getRemoteAddr(), request.getHeader(X_FORWARDED_FOR_HEADER)); } @Autowired(required = true)  ClientInfoServiceImpl(ConfigurationService configurationService); }
ClientInfoServiceImpl implements ClientInfoService { @Override public String getClientIp(HttpServletRequest request) { return getClientIp(request.getRemoteAddr(), request.getHeader(X_FORWARDED_FOR_HEADER)); } @Autowired(required = true)  ClientInfoServiceImpl(ConfigurationService configurationService); @Override String getClientIp(HttpServletRequest request); @Override String getClientIp(String remoteIp, String xForwardedForHeaderValue); @Override boolean isUseProxiesEnabled(); }
ClientInfoServiceImpl implements ClientInfoService { @Override public String getClientIp(HttpServletRequest request) { return getClientIp(request.getRemoteAddr(), request.getHeader(X_FORWARDED_FOR_HEADER)); } @Autowired(required = true)  ClientInfoServiceImpl(ConfigurationService configurationService); @Override String getClientIp(HttpServletRequest request); @Override String getClientIp(String remoteIp, String xForwardedForHeaderValue); @Override boolean isUseProxiesEnabled();  }