public void process(Exchange exchange) throws Exception {
Api api = this.dataManager.getApiById(apiId, false);
HttpServletRequest request = (HttpServletRequest) exchange.getIn().getHeader(Exchange.HTTP_SERVLET_REQUEST);
//retrieve the real IP adress from the request
String remoteAddr = CommonTools.remoteAddr(request);
CanonicalizedIpAddress ip = new CanonicalizedIpAddress(remoteAddr);
if(this.dataManager.isIpAllowed(api, ip.getIp())) {
exchange.setProperty(ExchangeConstantKeys.E3_API.toString(), api);
}
else {
Exception exception = new GatewayException(GatewayExceptionCode.AUTHORIZATION, "Not Authorized from this IP address");
exchange.setException(exception);