Session session = repo.login(creds);
AuthenticationManager authenticationManager =
new JcrAuthenticationManager(session);
Assert.assertFalse(authenticationManager.authenticate(
new SimpleAuthenticationIdentity("jimbo","jimbo")).isValid());
Assert.assertFalse(authenticationManager.authenticate(
new SimpleAuthenticationIdentity("admin","admin1")).isValid());
Assert.assertFalse(authenticationManager.authenticate(
new SimpleAuthenticationIdentity("joe","password")).isValid());
Assert.assertFalse(authenticationManager.authenticate(
new SimpleAuthenticationIdentity("jimbo")).isValid());
// in this repository, the superuser account is open with any password
Assert.assertTrue(authenticationManager.authenticate(
new SimpleAuthenticationIdentity(null,"jimbo")).isValid());
Assert.assertTrue(authenticationManager.authenticate(
new SimpleAuthenticationIdentity(null)).isValid());
Assert.assertTrue(authenticationManager.authenticate(
new SimpleAuthenticationIdentity("admin","admin")).isValid());
Assert.assertTrue(authenticationManager.authenticate(
new SimpleAuthenticationIdentity("joe","joe")).isValid());
Assert.assertTrue(authenticationManager.authenticate(
new SimpleAuthenticationIdentity("mary","mary")).isValid());
}