In my application I have written to find IP Address of user.
HttpServletRequest httpRequest = (HttpServletRequest) request;
String userIpAddress = httpRequest.getHeader("X-Forwarded-For");
HttpServletRequest.getLocalAddr();
And getting the server ips can be done so:
Inet4Address.getLocalHost().getHostAddress();
So, If the user already logged in from one ip address, how to restrict his login from another ip address?