public void testAnonymousAccessDenied2() throws Exception {
Map<String, String> config = new HashMap<String, String>();
config.put(UserAccessControlProvider.PARAM_ANONYMOUS_ACCESS, "false");
config.put(UserAccessControlProvider.PARAM_ANONYMOUS_ID, "abc");
AccessControlProvider p2 = new UserAccessControlProvider();
try {
p2.init(s, config);
Principal princ = new Principal() {
public String getName() {
return "abc";
}
};
Set<Principal> anonymousPrincipals = Collections.singleton(princ);
assertFalse(p2.canAccessRoot(anonymousPrincipals));
CompiledPermissions cp = p2.compilePermissions(anonymousPrincipals);
try {
assertEquals(CompiledPermissions.NO_PERMISSION, cp);
assertFalse(cp.canReadAll());
assertFalse(cp.grants(((NodeImpl) s.getRootNode()).getPrimaryPath(), Permission.READ));
} finally {
cp.close();
}
} finally {
p2.close();
}
}