private UserGroupCallback createLdapUserGroupCallbackWithUserCtx(SearchScope searchScope, String userCtx) { Properties properties = createUserGroupCallbackProperties(searchScope); properties.setProperty(LDAPUserGroupCallbackImpl.USER_CTX, userCtx); return new LDAPUserGroupCallbackImpl(properties); }
private Properties createUserGroupCallbackProperties(SearchScope searchScope) { Properties properties = createUserGroupCallbackProperties(); properties.setProperty(LDAPUserGroupCallbackImpl.SEARCH_SCOPE, searchScope.name()); return properties; }
private UserGroupCallback createLdapUserGroupCallbackWithRoleCtx(SearchScope searchScope, String roleCtx) { Properties properties = createUserGroupCallbackProperties(searchScope); properties.setProperty(LDAPUserGroupCallbackImpl.ROLE_CTX, roleCtx); return new LDAPUserGroupCallbackImpl(properties); }
private UserGroupCallback createLdapUserGroupCallback(Configuration config) { switch (config) { case CUSTOM: return new LDAPUserGroupCallbackImpl(createUserGroupCallbackProperties()); case SYSTEM: System.setProperty("jbpm.usergroup.callback.properties", "/jbpm.usergroup.callback.properties"); case DEFAULT: return new LDAPUserGroupCallbackImpl(true); default: throw new IllegalArgumentException("unknown config type"); } }
@Test public void testInvalidScope() { Properties properties = createUserGroupCallbackProperties(); properties.setProperty(LDAPUserGroupCallbackImpl.SEARCH_SCOPE, "abc"); UserGroupCallback ldapUserGroupCallback = new LDAPUserGroupCallbackImpl(properties); assertUsers(ldapUserGroupCallback, true, true, false, false); assertGroups(ldapUserGroupCallback, true, true, false, false); }
@Test public void testDefaultScope() { Properties properties = createUserGroupCallbackProperties(); UserGroupCallback ldapUserGroupCallback = new LDAPUserGroupCallbackImpl(properties); assertUsers(ldapUserGroupCallback, true, true, false, false); assertGroups(ldapUserGroupCallback, true, true, false, false); }