/** * Throws a <code>java.lang.SecurityException</code> if the client is not * connected via the loopback address. */ public void assertLoopbackClient() { if (!getInetAddress().isLoopbackAddress()) { throw (new SecurityException("Client is not at loopback address.")); } }
/** * Throws a <code>java.lang.SecurityException</code> if the client is not * connected from the local machine. */ public void assertLocalClient() { NetworkInterface iface = null; try { iface = NetworkInterface.getByInetAddress(getInetAddress()); } catch (java.net.SocketException se) { throw (new SecurityException("Unable to determine if client is local. Assuming he isn't.")); } if ((iface == null) && (!getInetAddress().isLoopbackAddress())) { throw (new SecurityException("Client is not local.")); } } }