List of usage examples for java.net ConnectException getMessage
public String getMessage()
From source file:com.cws.esolutions.security.dao.usermgmt.impl.LDAPUserManager.java
/** * @see com.cws.esolutions.security.dao.usermgmt.interfaces.UserManager#modifyOlrLock(java.lang.String, boolean) *///ww w . j a va 2s . com public synchronized boolean modifyOlrLock(final String userId, final boolean isLocked) throws UserManagementException { final String methodName = LDAPUserManager.CNAME + "#modifyOlrLock(final String userId, final boolean isLocked) throws UserManagementException"; if (DEBUG) { DEBUGGER.debug(methodName); DEBUGGER.debug("userId: {}", userId); DEBUGGER.debug("Value: {}", isLocked); } boolean isComplete = false; LDAPConnection ldapConn = null; LDAPConnectionPool ldapPool = null; try { ldapPool = (LDAPConnectionPool) svcBean.getAuthDataSource(); if (DEBUG) { DEBUGGER.debug("LDAPConnectionPool: {}", ldapPool); } if (ldapPool.isClosed()) { throw new ConnectException("Failed to create LDAP connection using the specified information"); } ldapConn = ldapPool.getConnection(); if (DEBUG) { DEBUGGER.debug("LDAPConnection: {}", ldapConn); } if (!(ldapConn.isConnected())) { throw new ConnectException("Failed to create LDAP connection using the specified information"); } List<Modification> modifyList = new ArrayList<Modification>(Arrays.asList(new Modification( ModificationType.REPLACE, securityAttributes.getOlrLocked(), String.valueOf(isLocked)))); LDAPResult ldapResult = ldapConn.modify( new ModifyRequest(new StringBuilder().append(userAttributes.getUserId() + "=" + userId + ",") .append(repoConfig.getRepositoryUserBase() + "," + repoConfig.getRepositoryBaseDN()) .toString(), modifyList)); if (DEBUG) { DEBUGGER.debug("LDAPResult: {}", ldapResult); } isComplete = (ldapResult.getResultCode() == ResultCode.SUCCESS); if (DEBUG) { DEBUGGER.debug("isComplete: {}", isComplete); } } catch (LDAPException lx) { throw new UserManagementException(lx.getMessage(), lx); } catch (ConnectException cx) { throw new UserManagementException(cx.getMessage(), cx); } finally { if ((ldapPool != null) && ((ldapConn != null) && (ldapConn.isConnected()))) { ldapConn.close(); ldapPool.releaseConnection(ldapConn); } } return isComplete; }
From source file:com.cws.esolutions.security.dao.usermgmt.impl.LDAPUserManager.java
/** * @see com.cws.esolutions.security.dao.usermgmt.interfaces.UserManager#modifyUserSuspension(java.lang.String, boolean) *//*from ww w. java 2s. c o m*/ public synchronized boolean modifyUserSuspension(final String userId, final boolean isSuspended) throws UserManagementException { final String methodName = LDAPUserManager.CNAME + "#modifyUserSuspension(final String userDN, final boolean isSuspended) throws UserManagementException"; if (DEBUG) { DEBUGGER.debug(methodName); DEBUGGER.debug("Value: {}", userId); DEBUGGER.debug("Value: {}", isSuspended); } boolean isComplete = false; LDAPConnection ldapConn = null; LDAPConnectionPool ldapPool = null; try { ldapPool = (LDAPConnectionPool) svcBean.getAuthDataSource(); if (DEBUG) { DEBUGGER.debug("LDAPConnectionPool: {}", ldapPool); } if (ldapPool.isClosed()) { throw new ConnectException("Failed to create LDAP connection using the specified information"); } ldapConn = ldapPool.getConnection(); if (DEBUG) { DEBUGGER.debug("LDAPConnection: {}", ldapConn); } if (!(ldapConn.isConnected())) { throw new ConnectException("Failed to create LDAP connection using the specified information"); } List<Modification> modifyList = new ArrayList<Modification>(Arrays.asList(new Modification( ModificationType.REPLACE, securityAttributes.getIsSuspended(), String.valueOf(isSuspended)))); if (DEBUG) { DEBUGGER.debug("modifyList: {}", modifyList); } LDAPResult ldapResult = ldapConn.modify( new ModifyRequest(new StringBuilder().append(userAttributes.getUserId() + "=" + userId + ",") .append(repoConfig.getRepositoryUserBase() + "," + repoConfig.getRepositoryBaseDN()) .toString(), modifyList)); if (DEBUG) { DEBUGGER.debug("LDAPResult: {}", ldapResult); } if (ldapResult.getResultCode() == ResultCode.SUCCESS) { isComplete = true; } } catch (LDAPException lx) { throw new UserManagementException(lx.getMessage(), lx); } catch (ConnectException cx) { throw new UserManagementException(cx.getMessage(), cx); } finally { if ((ldapPool != null) && ((ldapConn != null) && (ldapConn.isConnected()))) { ldapConn.close(); ldapPool.releaseConnection(ldapConn); } } return isComplete; }
From source file:com.cws.esolutions.security.dao.usermgmt.impl.LDAPUserManager.java
/** * @see com.cws.esolutions.security.dao.usermgmt.interfaces.UserManager#modifyUserPassword(java.lang.String, java.lang.String) *//*from ww w . j av a 2s . co m*/ public synchronized boolean modifyUserPassword(final String userId, final String newPass) throws UserManagementException { final String methodName = LDAPUserManager.CNAME + "#modifyUserPassword(final String userId, final String newPass) throws UserManagementException"; if (DEBUG) { DEBUGGER.debug(methodName); DEBUGGER.debug("Value: {}", userId); } boolean isComplete = false; LDAPConnection ldapConn = null; LDAPConnectionPool ldapPool = null; try { ldapPool = (LDAPConnectionPool) svcBean.getAuthDataSource(); if (DEBUG) { DEBUGGER.debug("LDAPConnectionPool: {}", ldapPool); } if (ldapPool.isClosed()) { throw new ConnectException("Failed to create LDAP connection using the specified information"); } ldapConn = ldapPool.getConnection(); if (DEBUG) { DEBUGGER.debug("LDAPConnection: {}", ldapConn); } if (!(ldapConn.isConnected())) { throw new ConnectException("Failed to create LDAP connection using the specified information"); } Calendar cal = Calendar.getInstance(); cal.add(Calendar.DATE, secConfig.getPasswordExpiration()); List<Modification> modifyList = new ArrayList<Modification>(Arrays.asList( new Modification(ModificationType.REPLACE, securityAttributes.getUserPassword(), newPass), new Modification(ModificationType.REPLACE, securityAttributes.getExpiryDate(), String.valueOf(cal.getTime())))); LDAPResult ldapResult = ldapConn.modify( new ModifyRequest(new StringBuilder().append(userAttributes.getUserId() + "=" + userId + ",") .append(repoConfig.getRepositoryUserBase() + "," + repoConfig.getRepositoryBaseDN()) .toString(), modifyList)); if (DEBUG) { DEBUGGER.debug("LDAPResult: {}", ldapResult); } isComplete = (ldapResult.getResultCode() == ResultCode.SUCCESS); if (DEBUG) { DEBUGGER.debug("isComplete: {}", isComplete); } } catch (LDAPException lx) { throw new UserManagementException(lx.getMessage(), lx); } catch (ConnectException cx) { throw new UserManagementException(cx.getMessage(), cx); } finally { if ((ldapPool != null) && ((ldapConn != null) && (ldapConn.isConnected()))) { ldapConn.close(); ldapPool.releaseConnection(ldapConn); } } return isComplete; }
From source file:com.cws.esolutions.security.dao.usermgmt.impl.LDAPUserManager.java
/** * @see com.cws.esolutions.security.dao.usermgmt.interfaces.UserManager#validateUserAccount(java.lang.String, java.lang.String) *///from w w w . j a v a 2 s . com public synchronized boolean validateUserAccount(final String userId, final String userGuid) throws UserManagementException { final String methodName = LDAPUserManager.CNAME + "#validateUserAccount(final String userID, final String userGuid) throws UserManagementException"; if (DEBUG) { DEBUGGER.debug(methodName); DEBUGGER.debug("userId: {}", userId); DEBUGGER.debug("userGuid: {}", userGuid); } boolean isValid = false; LDAPConnection ldapConn = null; LDAPConnectionPool ldapPool = null; try { ldapPool = (LDAPConnectionPool) svcBean.getAuthDataSource(); if (DEBUG) { DEBUGGER.debug("LDAPConnectionPool: {}", ldapPool); } if (ldapPool.isClosed()) { throw new ConnectException("Failed to create LDAP connection using the specified information"); } ldapConn = ldapPool.getConnection(); if (DEBUG) { DEBUGGER.debug("LDAPConnection: {}", ldapConn); } if (!(ldapConn.isConnected())) { throw new ConnectException("Failed to create LDAP connection using the specified information"); } Filter searchFilter = Filter.create("(&(objectClass=" + repoConfig.getBaseObject() + ")" + "(|(cn=" + userGuid + ")" + "(uid=" + userId + ")))"); if (DEBUG) { DEBUGGER.debug("Filter: {}", searchFilter); } SearchRequest searchRequest = new SearchRequest(repoConfig.getRepositoryBaseDN(), SearchScope.SUB, searchFilter, "cn"); if (DEBUG) { DEBUGGER.debug("SearchRequest: {}", searchRequest); } SearchResult searchResult = ldapConn.search(searchRequest); if (DEBUG) { DEBUGGER.debug("searchResult: {}", searchResult); } if ((searchResult.getResultCode() != ResultCode.SUCCESS) || (searchResult.getEntryCount() == 0)) { return true; } } catch (LDAPException lx) { throw new UserManagementException(lx.getMessage(), lx); } catch (ConnectException cx) { throw new UserManagementException(cx.getMessage(), cx); } finally { if ((ldapPool != null) && ((ldapConn != null) && (ldapConn.isConnected()))) { ldapConn.close(); ldapPool.releaseConnection(ldapConn); } } return isValid; }
From source file:com.cws.esolutions.security.dao.usermgmt.impl.LDAPUserManager.java
/** * @see com.cws.esolutions.security.dao.usermgmt.interfaces.UserManager#modifyUserLock(java.lang.String, boolean, int) *///from w w w. j a va 2 s .c o m public synchronized boolean modifyUserLock(final String userId, final boolean isLocked, final int increment) throws UserManagementException { final String methodName = LDAPUserManager.CNAME + "#modifyUserLock(final String userId, final boolean isLocked, final int increment) throws UserManagementException"; if (DEBUG) { DEBUGGER.debug(methodName); DEBUGGER.debug("userId: {}", userId); DEBUGGER.debug("Value: {}", isLocked); DEBUGGER.debug("Value: {}", increment); } boolean isComplete = false; LDAPConnection ldapConn = null; LDAPConnectionPool ldapPool = null; try { ldapPool = (LDAPConnectionPool) svcBean.getAuthDataSource(); if (DEBUG) { DEBUGGER.debug("LDAPConnectionPool: {}", ldapPool); } if (ldapPool.isClosed()) { throw new ConnectException("Failed to create LDAP connection using the specified information"); } ldapConn = ldapPool.getConnection(); if (DEBUG) { DEBUGGER.debug("LDAPConnection: {}", ldapConn); } if (!(ldapConn.isConnected())) { throw new ConnectException("Failed to create LDAP connection using the specified information"); } List<Modification> modifyList = new ArrayList<Modification>(); if (isLocked) { modifyList.add(new Modification(ModificationType.REPLACE, securityAttributes.getLockCount(), "3")); } else { modifyList.add(new Modification(ModificationType.REPLACE, securityAttributes.getLockCount(), String.valueOf(increment))); } LDAPResult ldapResult = ldapConn.modify( new ModifyRequest(new StringBuilder().append(userAttributes.getUserId() + "=" + userId + ",") .append(repoConfig.getRepositoryUserBase() + "," + repoConfig.getRepositoryBaseDN()) .toString(), modifyList)); if (DEBUG) { DEBUGGER.debug("LDAPResult: {}", ldapResult); } isComplete = (ldapResult.getResultCode() == ResultCode.SUCCESS); if (DEBUG) { DEBUGGER.debug("isComplete: {}", isComplete); } } catch (LDAPException lx) { throw new UserManagementException(lx.getMessage(), lx); } catch (ConnectException cx) { throw new UserManagementException(cx.getMessage(), cx); } finally { if ((ldapPool != null) && ((ldapConn != null) && (ldapConn.isConnected()))) { ldapConn.close(); ldapPool.releaseConnection(ldapConn); } } return isComplete; }
From source file:com.cws.esolutions.security.dao.usermgmt.impl.LDAPUserManager.java
/** * @see com.cws.esolutions.security.dao.usermgmt.interfaces.UserManager#modifyUserSecurity(java.lang.String, java.util.List) *//*from w w w. ja v a2 s . c o m*/ public synchronized boolean modifyUserSecurity(final String userId, final List<String> values) throws UserManagementException { final String methodName = LDAPUserManager.CNAME + "#modifyUserSecurity(final String userId, final Map<String, String> values) throws UserManagementException"; if (DEBUG) { DEBUGGER.debug(methodName); DEBUGGER.debug("Value: {}", userId); } boolean isComplete = false; LDAPConnection ldapConn = null; LDAPConnectionPool ldapPool = null; try { ldapPool = (LDAPConnectionPool) svcBean.getAuthDataSource(); if (DEBUG) { DEBUGGER.debug("LDAPConnectionPool: {}", ldapPool); } if (ldapPool.isClosed()) { throw new ConnectException("Failed to create LDAP connection using the specified information"); } ldapConn = ldapPool.getConnection(); if (DEBUG) { DEBUGGER.debug("LDAPConnection: {}", ldapConn); } if (!(ldapConn.isConnected())) { throw new ConnectException("Failed to create LDAP connection using the specified information"); } List<Modification> modifyList = new ArrayList<Modification>(Arrays.asList( new Modification(ModificationType.REPLACE, securityAttributes.getSecQuestionOne(), values.get(0)), new Modification(ModificationType.REPLACE, securityAttributes.getSecQuestionTwo(), values.get(1)), new Modification(ModificationType.REPLACE, securityAttributes.getSecAnswerOne(), values.get(2)), new Modification(ModificationType.REPLACE, securityAttributes.getSecAnswerTwo(), values.get(3)))); if (DEBUG) { DEBUGGER.debug("modifyList: {}", modifyList); } LDAPResult ldapResult = ldapConn.modify( new ModifyRequest(new StringBuilder().append(userAttributes.getUserId() + "=" + userId + ",") .append(repoConfig.getRepositoryUserBase() + "," + repoConfig.getRepositoryBaseDN()) .toString(), modifyList)); if (DEBUG) { DEBUGGER.debug("LDAPResult: {}", ldapResult); } if (ldapResult.getResultCode() == ResultCode.SUCCESS) { isComplete = true; } } catch (LDAPException lx) { throw new UserManagementException(lx.getMessage(), lx); } catch (ConnectException cx) { throw new UserManagementException(cx.getMessage(), cx); } finally { if ((ldapPool != null) && ((ldapConn != null) && (ldapConn.isConnected()))) { ldapConn.close(); ldapPool.releaseConnection(ldapConn); } } return isComplete; }
From source file:com.cws.esolutions.security.dao.usermgmt.impl.LDAPUserManager.java
/** * @see com.cws.esolutions.security.dao.usermgmt.interfaces.UserManager#modifyOtpSecret(java.lang.String, boolean, java.lang.String) */// w w w .ja v a2 s .c om public synchronized boolean modifyOtpSecret(final String userId, final boolean addSecret, final String secret) throws UserManagementException { final String methodName = LDAPUserManager.CNAME + "#modifyOtpSecret(final String userId, final boolean addSecret, final String secret) throws UserManagementException"; if (DEBUG) { DEBUGGER.debug(methodName); DEBUGGER.debug("Value: {}", userId); DEBUGGER.debug("Value: {}", addSecret); } boolean isComplete = false; LDAPConnection ldapConn = null; LDAPConnectionPool ldapPool = null; try { ldapPool = (LDAPConnectionPool) svcBean.getAuthDataSource(); if (DEBUG) { DEBUGGER.debug("LDAPConnectionPool: {}", ldapPool); } if (ldapPool.isClosed()) { throw new ConnectException("Failed to create LDAP connection using the specified information"); } ldapConn = ldapPool.getConnection(); if (DEBUG) { DEBUGGER.debug("LDAPConnection: {}", ldapConn); } if (!(ldapConn.isConnected())) { throw new ConnectException("Failed to create LDAP connection using the specified information"); } List<Modification> modifyList = new ArrayList<Modification>(); if (addSecret) { modifyList.add(new Modification(ModificationType.REPLACE, securityAttributes.getSecret(), secret)); } else { modifyList.add(new Modification(ModificationType.DELETE, securityAttributes.getSecret())); } if (DEBUG) { DEBUGGER.debug("List<Modification>: {}", modifyList); } LDAPResult ldapResult = ldapConn.modify( new ModifyRequest(new StringBuilder().append(userAttributes.getUserId() + "=" + userId + ",") .append(repoConfig.getRepositoryUserBase() + "," + repoConfig.getRepositoryBaseDN()) .toString(), modifyList)); if (DEBUG) { DEBUGGER.debug("LDAPResult: {}", ldapResult); } isComplete = (ldapResult.getResultCode() == ResultCode.SUCCESS); if (DEBUG) { DEBUGGER.debug("isComplete: {}", isComplete); } } catch (LDAPException lx) { throw new UserManagementException(lx.getMessage(), lx); } catch (ConnectException cx) { throw new UserManagementException(cx.getMessage(), cx); } finally { if ((ldapPool != null) && ((ldapConn != null) && (ldapConn.isConnected()))) { ldapConn.close(); ldapPool.releaseConnection(ldapConn); } } return isComplete; }
From source file:com.cws.esolutions.security.dao.usermgmt.impl.LDAPUserManager.java
/** * @see com.cws.esolutions.security.dao.usermgmt.interfaces.UserManager#listUserAccounts() *//* w ww .ja v a 2s . c o m*/ public synchronized List<String[]> listUserAccounts() throws UserManagementException { final String methodName = LDAPUserManager.CNAME + "#listUserAccounts() throws UserManagementException"; if (DEBUG) { DEBUGGER.debug(methodName); } List<String[]> results = null; LDAPConnection ldapConn = null; LDAPConnectionPool ldapPool = null; try { ldapPool = (LDAPConnectionPool) svcBean.getAuthDataSource(); if (DEBUG) { DEBUGGER.debug("LDAPConnectionPool: {}", ldapPool); } if (ldapPool.isClosed()) { throw new ConnectException("Failed to create LDAP connection using the specified information"); } ldapConn = ldapPool.getConnection(); if (DEBUG) { DEBUGGER.debug("LDAPConnection: {}", ldapConn); } if (!(ldapConn.isConnected())) { throw new ConnectException("Failed to create LDAP connection using the specified information"); } SearchRequest searchReq = new SearchRequest( repoConfig.getRepositoryUserBase() + "," + repoConfig.getRepositoryBaseDN(), SearchScope.SUB, Filter.create("(&(objectClass=" + repoConfig.getBaseObject() + "))")); if (DEBUG) { DEBUGGER.debug("searchRequest: {}", searchReq); } SearchResult searchResult = ldapConn.search(searchReq); if (DEBUG) { DEBUGGER.debug("searchResult: {}", searchResult); } if (searchResult.getResultCode() == ResultCode.SUCCESS) { results = new ArrayList<String[]>(); for (SearchResultEntry entry : searchResult.getSearchEntries()) { String[] userData = new String[] { entry.getAttributeValue(userAttributes.getCommonName()), entry.getAttributeValue(userAttributes.getUserId()) }; if (DEBUG) { for (String str : userData) { DEBUGGER.debug(str); } } results.add(userData); } } else { throw new ConnectException("No users were located with the search data provided"); } } catch (LDAPException lx) { throw new UserManagementException(lx.getMessage(), lx); } catch (ConnectException cx) { throw new UserManagementException(cx.getMessage(), cx); } finally { if ((ldapPool != null) && ((ldapConn != null) && (ldapConn.isConnected()))) { ldapConn.close(); ldapPool.releaseConnection(ldapConn); } } return results; }
From source file:com.cws.esolutions.security.dao.usermgmt.impl.LDAPUserManager.java
/** * @see com.cws.esolutions.security.dao.usermgmt.interfaces.UserManager#modifyUserGroups(java.lang.String, java.lang.Object[]) *//*from ww w. jav a2 s . c o m*/ public synchronized boolean modifyUserGroups(final String userId, final Object[] value) throws UserManagementException { final String methodName = LDAPUserManager.CNAME + "#modifyUserGroups(final String userId, final Object[] value) throws UserManagementException"; if (DEBUG) { DEBUGGER.debug(methodName); DEBUGGER.debug("userId: {}", userId); DEBUGGER.debug("userGuid: {}", value); } boolean isComplete = false; LDAPConnection ldapConn = null; LDAPConnectionPool ldapPool = null; final StringBuilder userDN = new StringBuilder().append(userAttributes.getUserId() + "=" + userId + ",") .append(repoConfig.getRepositoryUserBase() + "," + repoConfig.getRepositoryBaseDN()); try { ldapPool = (LDAPConnectionPool) svcBean.getAuthDataSource(); if (DEBUG) { DEBUGGER.debug("LDAPConnectionPool: {}", ldapPool); } if (ldapPool.isClosed()) { throw new ConnectException("Failed to create LDAP connection using the specified information"); } ldapConn = ldapPool.getConnection(); if (DEBUG) { DEBUGGER.debug("LDAPConnection: {}", ldapConn); } if (!(ldapConn.isConnected())) { throw new ConnectException("Failed to create LDAP connection using the specified information"); } for (Object group : value) { if (DEBUG) { DEBUGGER.debug("Group: {}", group); } StringBuilder roleDN = new StringBuilder() .append(userAttributes.getCommonName() + "=" + (String) group) .append(repoConfig.getRepositoryRoleBase()); if (DEBUG) { DEBUGGER.debug("StringBuilder: {}", roleDN); } AddRequest addRequest = new AddRequest(roleDN.toString(), new ArrayList<Attribute>(Arrays.asList(new Attribute("objectClass", "uniqueMember"), new Attribute("uniqueMember", userDN.toString())))); if (DEBUG) { DEBUGGER.debug("AddRequest: {}", addRequest); } LDAPResult ldapResult = ldapConn.add(addRequest); if (ldapResult.getResultCode() == ResultCode.SUCCESS) { isComplete = true; } } } catch (LDAPException lx) { throw new UserManagementException(lx.getMessage(), lx); } catch (ConnectException cx) { throw new UserManagementException(cx.getMessage(), cx); } finally { if ((ldapPool != null) && ((ldapConn != null) && (ldapConn.isConnected()))) { ldapConn.close(); ldapPool.releaseConnection(ldapConn); } } return isComplete; }
From source file:com.cws.esolutions.security.dao.usermgmt.impl.LDAPUserManager.java
/** * @see com.cws.esolutions.security.dao.usermgmt.interfaces.UserManager#searchUsers(java.lang.String) *//*from ww w.j ava 2 s. c om*/ public synchronized List<String[]> searchUsers(final String searchData) throws UserManagementException { final String methodName = LDAPUserManager.CNAME + "#searchUsers(final String searchData) throws UserManagementException"; if (DEBUG) { DEBUGGER.debug(methodName); DEBUGGER.debug("Value: {}", searchData); } List<String[]> results = null; LDAPConnection ldapConn = null; LDAPConnectionPool ldapPool = null; try { ldapPool = (LDAPConnectionPool) svcBean.getAuthDataSource(); if (DEBUG) { DEBUGGER.debug("LDAPConnectionPool: {}", ldapPool); } if (ldapPool.isClosed()) { throw new ConnectException("Failed to create LDAP connection using the specified information"); } ldapConn = ldapPool.getConnection(); if (DEBUG) { DEBUGGER.debug("LDAPConnection: {}", ldapConn); } if (!(ldapConn.isConnected())) { throw new ConnectException("Failed to create LDAP connection using the specified information"); } Filter searchFilter = Filter.create("(&(objectClass=" + repoConfig.getBaseObject() + ")" + "(|(" + userAttributes.getCommonName() + "=" + searchData + ")" + "(" + userAttributes.getUserId() + "=" + searchData + ")" + "(" + userAttributes.getEmailAddr() + "=" + searchData + ")" + "(" + userAttributes.getGivenName() + "=" + searchData + ")" + "(" + userAttributes.getSurname() + "=" + searchData + ")" + "(" + userAttributes.getDisplayName() + "=" + searchData + ")))"); if (DEBUG) { DEBUGGER.debug("searchFilter: {}", searchFilter); } SearchRequest searchReq = new SearchRequest( repoConfig.getRepositoryUserBase() + "," + repoConfig.getRepositoryBaseDN(), SearchScope.SUB, searchFilter, userAttributes.getCommonName(), userAttributes.getUserId()); if (DEBUG) { DEBUGGER.debug("searchRequest: {}", searchReq); } SearchResult searchResult = ldapConn.search(searchReq); if (DEBUG) { DEBUGGER.debug("searchResult: {}", searchResult); } if (searchResult.getResultCode() == ResultCode.SUCCESS) { results = new ArrayList<String[]>(); for (SearchResultEntry entry : searchResult.getSearchEntries()) { String[] userData = new String[] { entry.getAttributeValue(userAttributes.getCommonName()), entry.getAttributeValue(userAttributes.getUserId()) }; if (DEBUG) { DEBUGGER.debug("Data: {}", (Object) userData); } results.add(userData); } } else { throw new UserManagementException("No users were located with the search data provided"); } } catch (LDAPException lx) { throw new UserManagementException(lx.getMessage(), lx); } catch (ConnectException cx) { throw new UserManagementException(cx.getMessage(), cx); } finally { if ((ldapPool != null) && ((ldapConn != null) && (ldapConn.isConnected()))) { ldapConn.close(); ldapPool.releaseConnection(ldapConn); } } return results; }