Java Code Examples for javax.naming.NamingException#toString()
The following examples show how to use
javax.naming.NamingException#toString() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ADMRealmImpl.java From development with Apache License 2.0 | 6 votes |
/** * Search the user in the LDAP and perform a bind to his data name. * * @return groups that this particular user belongs to. * @throws LoginException * if the login failed. */ String findAndBind(Properties ldapProperties, String baseDN, String searchFilter, String password) throws LoginException { String realUserDN = null; boolean bindSuccessful = false; try { realUserDN = userSearch(ldapProperties, baseDN, searchFilter); if (realUserDN == null) { throw new LoginException("No User found for '" + searchFilter + "'."); } bindSuccessful = bindAsUser(ldapProperties, realUserDN, password); if (bindSuccessful == false) { throw new LoginException("Bind with DN '" + realUserDN + "' failed."); } } catch (NamingException e) { throw new LoginException(e.toString()); } return realUserDN; }
Example 2
Source File: cfLDAP.java From openbd-core with GNU General Public License v3.0 | 6 votes |
private void doModify(cfStructData attributes, cfSession _Session, ldapConnection _conn) throws cfmRunTimeException, javax.naming.directory.AttributeModificationException { _conn.setDN(getDN(attributes,_Session)); _conn.setAttributes(getAttributes(attributes,_Session, getDynamic(attributes, _Session, "DELIMITER").getString().charAt(0))); String modifyType = getDynamic(attributes,_Session, "MODIFYTYPE").getString(); if (modifyType.equalsIgnoreCase("ADD")) { _conn.setModifyType(ldapConnection.MODIFY_ADD); } else if (modifyType.equalsIgnoreCase("DELETE")) { _conn.setModifyType(ldapConnection.MODIFY_DELETE); } else if (modifyType.equalsIgnoreCase("REPLACE")) { _conn.setModifyType(ldapConnection.MODIFY_REPLACE); } try { _conn.modify(); } catch (NamingException e) { String msg = e.toString(); Throwable rootCause = e.getRootCause(); if (rootCause != null) msg += "; ROOT CAUSE=" + rootCause.getMessage(); throw newRunTimeException(msg); } }
Example 3
Source File: cfLDAP.java From openbd-core with GNU General Public License v3.0 | 6 votes |
private void doModifyDN(cfStructData attributes, cfSession _Session, ldapConnection _conn) throws cfmRunTimeException { _conn.setDN(getDN(attributes,_Session)); String newDN = getDynamicAsString(attributes, _Session, "ATTRIBUTES"); _conn.setAttributes(new String[] { newDN }); try { _conn.modifyDN(); } catch (NamingException e) { String msg = e.toString(); Throwable rootCause = e.getRootCause(); if (rootCause != null) msg += "; ROOT CAUSE=" + rootCause.getMessage(); throw newRunTimeException(msg); } }
Example 4
Source File: LocalContext.java From unitime with Apache License 2.0 | 5 votes |
public Object nextElement() { try { return next(); } catch (NamingException e) { throw new NoSuchElementException(e.toString()); } }
Example 5
Source File: cfLDAP.java From openbd-core with GNU General Public License v3.0 | 5 votes |
private void doAdd(cfStructData attributes, cfSession _Session, ldapConnection _conn) throws cfmRunTimeException { _conn.setDN(getDN(attributes,_Session)); _conn.setAttributes(getAttributes(attributes,_Session, getDynamic(_Session, "DELIMITER").getString().charAt(0))); try { _conn.add(); } catch (NamingException e) { String msg = e.toString(); Throwable rootCause = e.getRootCause(); if (rootCause != null) msg += "; ROOT CAUSE=" + rootCause.getMessage(); throw newRunTimeException(msg); } }
Example 6
Source File: cfLDAP.java From openbd-core with GNU General Public License v3.0 | 5 votes |
private void doDelete(cfStructData attributes,cfSession _Session, ldapConnection _conn) throws cfmRunTimeException { _conn.setDN(getDN(attributes,_Session)); try { _conn.delete(); } catch (NamingException e) { String msg = e.toString(); Throwable rootCause = e.getRootCause(); if (rootCause != null) msg += "; ROOT CAUSE=" + rootCause.getMessage(); throw newRunTimeException(msg); } }
Example 7
Source File: cfLDAP.java From openbd-core with GNU General Public License v3.0 | 4 votes |
private void doQuery(cfStructData attributes, cfSession _Session, ldapConnection _conn) throws cfmRunTimeException { // query String[] att = getAttributes(attributes,_Session, ','); _conn.setAttributes(att); String scope = getDynamic(attributes,_Session, "SCOPE").getString(); if (scope.equalsIgnoreCase("ONELEVEL")) { _conn.setScope(ldapConnection.ONELEVEL_SCOPE); } else if (scope.equalsIgnoreCase("BASE")) { _conn.setScope(ldapConnection.BASE_SCOPE); } else { // scope must be subtree due to earlier check _conn.setScope(ldapConnection.SUBTREE_SCOPE); } String queryName = getDynamic(attributes,_Session, "NAME").getString(); _conn.setStart(getDynamic(attributes,_Session, "START").getString()); // the search base - a DN _conn.setFilter(getDynamic(attributes,_Session, "FILTER").getString()); int startRow = getDynamic(attributes,_Session, "STARTROW").getInt(); String sortAttribs = getDynamic(attributes,_Session, "SORT").getString(); // has def String sortControl = getDynamic(attributes,_Session, "SORTCONTROL").getString(); List<Map<String, String>> results = null; try { results = _conn.search(); } catch (NamingException e) { String msg = e.toString(); Throwable rootCause = e.getRootCause(); if (rootCause != null) msg += "; ROOT CAUSE=" + rootCause.getMessage(); throw newRunTimeException(msg); } int maxRows = getDynamic(attributes,_Session, "MAXROWS").getInt(); List<String> returnAsBinary = null; if (containsAttribute(attributes,"RETURNASBINARY")) { returnAsBinary = com.nary.util.string.split(getDynamic(attributes,_Session, "RETURNASBINARY").getString(), " "); } new cfldapQueryData(_Session, queryName, results, att, sortAttribs, sortControl, startRow, maxRows, returnAsBinary); }