federation/ldap/src/main/java/org/keycloak/federation/ldap/idm/store/ldap/LDAPOperationManager.java
/**
     * <p>
     * Performs a simple authentication using the given DN and password to bind to the authentication context.
     * </p>
     *
     * @param dn
     * @param password
     *
     * @return
     */

Performs a simple authentication using the given DN and password to bind to the authentication context.

@param dn
@param password

@return
Performs a simple authentication using the given DN and password to bind to the authentication context . @param dn @param password @return
public boolean authenticate(String dn, String password) {
        InitialContext authCtx = null;
        try {
            Hashtable<String, Object> env = new Hashtable<String, Object>(this.connectionProperties);
            env.put(Context.SECURITY_PRINCIPAL, dn);
            env.put(Context.SECURITY_CREDENTIALS, password);
            env.put("com.sun.jndi.ldap.connect.pool", "false");
            authCtx = new InitialLdapContext(env, null);
            return true;
        } catch (Exception e) {
            if (logger.isDebugEnabled()) {
                logger.debugf(e, "Authentication failed for DN [%s]", dn);
            }
            return false;
        } finally {
            if (authCtx != null) {
                try {
                    authCtx.close();
                } catch (NamingException e) {
                }
            }
        }
    }
public boolean authenticate ( String dn , String password ) { InitialContext authCtx = null ; try { Hashtable < String , Object > env = new Hashtable < String , Object > ( this . connectionProperties ) ; env . put ( Context . SECURITY_PRINCIPAL , dn ) ; env . put ( Context . SECURITY_CREDENTIALS , password ) ; env . put ( "com.sun.jndi.ldap.connect.pool" , "false" ) ; authCtx = new InitialLdapContext ( env , null ) ; return true ; } catch ( Exception e ) { if ( logger . isDebugEnabled ( ) ) { logger . debugf ( e , "Authentication failed for DN [%s]" , dn ) ; } return false ; } finally { if ( authCtx != null ) { try { authCtx . close ( ) ; } catch ( NamingException e ) { } } } }
<p>
 Performs a simple authentication using the given DN and password to bind to the authentication context.
<p > Performs a simple authentication using the given DN and password to bind to the authentication context .
// Never use connection pool to prevent password caching