Java Code Examples for javax.naming.directory.InitialDirContext#close()
The following examples show how to use
javax.naming.directory.InitialDirContext#close() .
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: LdapClient.java From iaf with Apache License 2.0 | 6 votes |
public String checkPassword(String userDN, String password, String baseDN, String returnedAttribute) throws NamingException { if (userDN==null || userDN.equals("") || password==null || password.equals("")) { return null; } Hashtable<String,Object> env = new Hashtable<String,Object>(); env.putAll(jndiEnv); env.put("com.sun.jndi.ldap.connect.pool","false"); env.put(Context.SECURITY_PRINCIPAL, userDN); env.put(Context.SECURITY_CREDENTIALS, password); // initiate private context, to avoid pooling of authentication InitialDirContext context = new InitialDirContext(env); try { return searchObjectForSingleAttribute(context,userDN,baseDN,returnedAttribute); } finally { context.close(); } }
Example 2
Source File: LDAPConnectionUtil.java From activiti6-boot2 with Apache License 2.0 | 5 votes |
public static void closeDirectoryContext(InitialDirContext initialDirContext) { try { initialDirContext.close(); } catch (NamingException e) { LOGGER.warn("Could not close InitialDirContext correctly!", e); } }
Example 3
Source File: SimpleLDAPAuthenticationManagerImpl.java From qpid-broker-j with Apache License 2.0 | 5 votes |
private void closeSafely(InitialDirContext ctx) { try { if (ctx != null) { ctx.close(); } } catch (Exception e) { LOGGER.warn("Exception closing InitialDirContext", e); } }
Example 4
Source File: LDAPConnectionUtil.java From flowable-engine with Apache License 2.0 | 5 votes |
public static void closeDirectoryContext(InitialDirContext initialDirContext) { try { initialDirContext.close(); } catch (NamingException e) { LOGGER.warn("Could not close InitialDirContext correctly!", e); } }