use of org.apache.jackrabbit.api.security.user.UserManager in project jackrabbit-oak by apache.
the class SyncMBeanImplTest method testSyncAllExternalUsersAgain.
@Test
public void testSyncAllExternalUsersAgain() throws Exception {
syncMBean.syncAllExternalUsers();
// sync again
String[] result = syncMBean.syncAllExternalUsers();
// verify result
Map<String, String> expected = getExpectedUserResult("upd", false);
assertResultMessages(result, expected);
UserManager userManager = getUserManager();
for (String id : expected.keySet()) {
ExternalIdentity ei = idp.getUser(id);
if (ei == null) {
ei = idp.getGroup(id);
}
assertSync(ei, userManager);
}
}
use of org.apache.jackrabbit.api.security.user.UserManager in project jackrabbit-oak by apache.
the class SyncMBeanImplTest method testPurgeOrphanedUsersThrowingHandler2.
/**
* @see <a href="https://issues.apache.org/jira/browse/OAK-4362">OAK-4362</a>
*/
@Test
public void testPurgeOrphanedUsersThrowingHandler2() throws Exception {
sync(new TestIdentityProvider.TestUser("thirdUser", idp.getName()), idp);
sync(new TestIdentityProvider.TestGroup("g", idp.getName()), idp);
String[] result = createThrowingSyncMBean(true).purgeOrphanedUsers();
assertResultMessages(result, ImmutableMap.of("thirdUser", "ERR", "g", "ERR"));
UserManager userManager = getUserManager();
assertNotNull(userManager.getAuthorizable("thirdUser"));
assertNotNull(userManager.getAuthorizable("g"));
}
use of org.apache.jackrabbit.api.security.user.UserManager in project jackrabbit-oak by apache.
the class SyncMBeanImplTest method testInitialSyncExternalUsersNoNesting.
@Test
public void testInitialSyncExternalUsersNoNesting() throws Exception {
syncConfig.user().setMembershipNestingDepth(-1);
ExternalUser externalUser = idp.getUser(TestIdentityProvider.ID_TEST_USER);
String[] externalId = new String[] { externalUser.getExternalId().getString() };
String[] result = syncMBean.syncExternalUsers(externalId);
assertResultMessages(result, TestIdentityProvider.ID_TEST_USER, "add");
UserManager userManager = getUserManager();
User testUser = userManager.getAuthorizable(externalUser.getId(), User.class);
assertNotNull(testUser);
for (ExternalIdentityRef groupRef : externalUser.getDeclaredGroups()) {
assertNull(userManager.getAuthorizable(groupRef.getId()));
}
}
use of org.apache.jackrabbit.api.security.user.UserManager in project jackrabbit-oak by apache.
the class SyncMBeanImplTest method testInitialSyncExternalUsers.
@Test
public void testInitialSyncExternalUsers() throws Exception {
ExternalUser externalUser = idp.getUser(TestIdentityProvider.ID_TEST_USER);
String[] externalId = new String[] { externalUser.getExternalId().getString() };
String[] result = syncMBean.syncExternalUsers(externalId);
assertResultMessages(result, TestIdentityProvider.ID_TEST_USER, "add");
UserManager userManager = getUserManager();
User testUser = userManager.getAuthorizable(externalUser.getId(), User.class);
assertNotNull(testUser);
for (ExternalIdentityRef groupRef : externalUser.getDeclaredGroups()) {
assertNotNull(userManager.getAuthorizable(groupRef.getId()));
}
}
use of org.apache.jackrabbit.api.security.user.UserManager in project jackrabbit by apache.
the class UserManagerImplTest method testCleanup.
public void testCleanup() throws RepositoryException, NotExecutableException {
Session s = getHelper().getSuperuserSession();
try {
UserManager umgr = getUserManager(s);
s.logout();
// any more -> accessing users must fail.
try {
umgr.getAuthorizable("any userid");
fail("After having logged out the original session, the user manager must not be live any more.");
} catch (RepositoryException e) {
// success
}
} finally {
if (s.isLive()) {
s.logout();
}
}
}
Aggregations