@Test public void testUserService() throws Exception { List<UserInfo> users = service.getUsers(new RoleUserFilter("testgroup")); assertThat(users).isNotNull(); assertThat(users.size()).isEqualTo(1); assertThat(users.get(0).getUserName()).isEqualTo("Joe Tester"); users = service.getUsers(new AllUserFilter()); assertThat(users).isNotNull(); assertThat(users.size()).isEqualTo(2); }
@Override public List<org.geomajas.security.UserInfo> getUsers(UserFilter userFilter) { List<org.geomajas.security.UserInfo> users = new ArrayList<org.geomajas.security.UserInfo>(); if (allUsersDn == null) { log.warn("Getting users from LDAP requires configuration of allUsersDn property"); } else { SearchRequest request = createSearchRequest(allUsersDn); LdapFilterVisitor visitor = new LdapFilterVisitor(); Filter ldapFilter = (Filter) userFilter.accept(visitor, null); if (ldapFilter != null) { Filter f = request.getFilter(); request.setFilter(Filter.createANDFilter(f, ldapFilter)); } SearchResult result = execute(request, null, null); if (result != null) { for (SearchResultEntry entry : result.getSearchEntries()) { users.add(getUserInfo(entry)); } } } return users; }
LdapAuthenticationService implements AuthenticationService, UserDirectoryService { @Override public List<org.geomajas.security.UserInfo> getUsers(UserFilter userFilter) { List<org.geomajas.security.UserInfo> users = new ArrayList<org.geomajas.security.UserInfo>(); if (allUsersDn == null) { log.warn("Getting users from LDAP requires configuration of allUsersDn property"); } else { SearchRequest request = createSearchRequest(allUsersDn); LdapFilterVisitor visitor = new LdapFilterVisitor(); Filter ldapFilter = (Filter) userFilter.accept(visitor, null); if (ldapFilter != null) { Filter f = request.getFilter(); request.setFilter(Filter.createANDFilter(f, ldapFilter)); } SearchResult result = execute(request, null, null); if (result != null) { for (SearchResultEntry entry : result.getSearchEntries()) { users.add(getUserInfo(entry)); } } } return users; } }
LdapAuthenticationService implements AuthenticationService, UserDirectoryService { @Override public List<org.geomajas.security.UserInfo> getUsers(UserFilter userFilter) { List<org.geomajas.security.UserInfo> users = new ArrayList<org.geomajas.security.UserInfo>(); if (allUsersDn == null) { log.warn("Getting users from LDAP requires configuration of allUsersDn property"); } else { SearchRequest request = createSearchRequest(allUsersDn); LdapFilterVisitor visitor = new LdapFilterVisitor(); Filter ldapFilter = (Filter) userFilter.accept(visitor, null); if (ldapFilter != null) { Filter f = request.getFilter(); request.setFilter(Filter.createANDFilter(f, ldapFilter)); } SearchResult result = execute(request, null, null); if (result != null) { for (SearchResultEntry entry : result.getSearchEntries()) { users.add(getUserInfo(entry)); } } } return users; }  }
LdapAuthenticationService implements AuthenticationService, UserDirectoryService { @Override public List<org.geomajas.security.UserInfo> getUsers(UserFilter userFilter) { List<org.geomajas.security.UserInfo> users = new ArrayList<org.geomajas.security.UserInfo>(); if (allUsersDn == null) { log.warn("Getting users from LDAP requires configuration of allUsersDn property"); } else { SearchRequest request = createSearchRequest(allUsersDn); LdapFilterVisitor visitor = new LdapFilterVisitor(); Filter ldapFilter = (Filter) userFilter.accept(visitor, null); if (ldapFilter != null) { Filter f = request.getFilter(); request.setFilter(Filter.createANDFilter(f, ldapFilter)); } SearchResult result = execute(request, null, null); if (result != null) { for (SearchResultEntry entry : result.getSearchEntries()) { users.add(getUserInfo(entry)); } } } return users; }  @Api void setServerHost(String serverHost); @Api void setServerPort(int serverPort); @Api void setAllowAllSocketFactory(boolean allowAllSocketFactory); @Api void setUserDnTemplate(String userDnTemplate); @Api void setAllUsersDn(String allUsersDn); @Api void setGivenNameAttribute(String givenNameAttribute); @Api void setSurNameAttribute(String surNameAttribute); @Api void setLocaleAttribute(String localeAttribute); @Api void setOrganizationAttribute(String organizationAttribute); @Api void setDivisionAttribute(String divisionAttribute); @Api void setRolesAttribute(String rolesAttribute); String getRolesAttribute(); List<AuthorizationInfo> getDefaultRole(); @Api void setDefaultRole(List<AuthorizationInfo> defaultRole); @Api void setRoles(Map<String, List<AuthorizationInfo>> roles); @Api void setNamedRoles(Map<String, List<NamedRoleInfo>> namedRoles); @Api Map<String, List<NamedRoleInfo>> getNamedRoles(); @Override String convertPassword(String user, String password); @Override UserInfo isAuthenticated(String user, String password); @Override List<org.geomajas.security.UserInfo> getUsers(UserFilter userFilter); @Api Filter convert(UserFilter filter); }
LdapAuthenticationService implements AuthenticationService, UserDirectoryService { @Override public List<org.geomajas.security.UserInfo> getUsers(UserFilter userFilter) { List<org.geomajas.security.UserInfo> users = new ArrayList<org.geomajas.security.UserInfo>(); if (allUsersDn == null) { log.warn("Getting users from LDAP requires configuration of allUsersDn property"); } else { SearchRequest request = createSearchRequest(allUsersDn); LdapFilterVisitor visitor = new LdapFilterVisitor(); Filter ldapFilter = (Filter) userFilter.accept(visitor, null); if (ldapFilter != null) { Filter f = request.getFilter(); request.setFilter(Filter.createANDFilter(f, ldapFilter)); } SearchResult result = execute(request, null, null); if (result != null) { for (SearchResultEntry entry : result.getSearchEntries()) { users.add(getUserInfo(entry)); } } } return users; }  @Api void setServerHost(String serverHost); @Api void setServerPort(int serverPort); @Api void setAllowAllSocketFactory(boolean allowAllSocketFactory); @Api void setUserDnTemplate(String userDnTemplate); @Api void setAllUsersDn(String allUsersDn); @Api void setGivenNameAttribute(String givenNameAttribute); @Api void setSurNameAttribute(String surNameAttribute); @Api void setLocaleAttribute(String localeAttribute); @Api void setOrganizationAttribute(String organizationAttribute); @Api void setDivisionAttribute(String divisionAttribute); @Api void setRolesAttribute(String rolesAttribute); String getRolesAttribute(); List<AuthorizationInfo> getDefaultRole(); @Api void setDefaultRole(List<AuthorizationInfo> defaultRole); @Api void setRoles(Map<String, List<AuthorizationInfo>> roles); @Api void setNamedRoles(Map<String, List<NamedRoleInfo>> namedRoles); @Api Map<String, List<NamedRoleInfo>> getNamedRoles(); @Override String convertPassword(String user, String password); @Override UserInfo isAuthenticated(String user, String password); @Override List<org.geomajas.security.UserInfo> getUsers(UserFilter userFilter); @Api Filter convert(UserFilter filter); @Api
	static final Filter ALL; @Api
	static final Filter NONE; @Api
	static final String DEFAULT_ROLE_NAME; }