UserDetailsService implements
        org.springframework.security.core.userdetails.AuthenticationUserDetailsService<PreAuthenticatedAuthenticationToken> { public Map<String, TimelyUser> getUsers() { return users; }  Map<String, TimelyUser> getUsers(); void setUsers(List<TimelyUser> users); @Override UserDetails loadUserDetails(final PreAuthenticatedAuthenticationToken token);  }
@Test public void testAuths() { TimelyUser u = userDetailsService.getUsers().get("CN=example.com"); Assert.assertNotNull("TimelyUser not found", u); Assert.assertEquals("3 auths expected", 3, u.getAuths().size()); Assert.assertTrue("Unexpected auths found " + u.getAuths(), u.getAuths().containsAll(Arrays.asList("D", "E", "F"))); }
@Test public void testRoles() { TimelyUser u = userDetailsService.getUsers().get("CN=example.com"); Assert.assertNotNull("TimelyUser not found", u); Assert.assertEquals("3 roles expected", 3, u.getRoles().size()); Assert.assertTrue("Unexpected roles found " + u.getRoles(), u.getRoles().containsAll(Arrays.asList("G", "H", "I"))); }