DuracloudAuthProvider extends DaoAuthenticationProvider { protected boolean ipInRange(String ipAddress, String range) { IpAddressMatcher addressMatcher = new IpAddressMatcher(range); return addressMatcher.matches(ipAddress); } DuracloudAuthProvider(DuracloudUserDetailsService userDetailsService,
                                 Object passwordEncoder);   }
@Test public void testIpInRange() { DuracloudAuthProvider authProvider = new DuracloudAuthProvider(null, new ShaPasswordEncoder(256)); assertTrue(authProvider.ipInRange("1.2.3.4", "1.1.1.1/0")); assertTrue(authProvider.ipInRange("1.2.3.4", "1.2.3.4/32")); assertTrue(authProvider.ipInRange("1.2.3.127", "1.2.3.4/25")); assertFalse(authProvider.ipInRange("1.2.2.2", "1.2.3.4/30")); assertFalse(authProvider.ipInRange("1.2.3.5", "1.2.3.4/32")); }