code: @Override
      public boolean checkCredentials(final String uid, final String password) {
          StringBuilder sb = new StringBuilder(userIdentifyer + "=").append(uid).append(",");
          sb.append(Configuration.getProperty(instanceName + LdapKeys.ATTR_OU_PEOPLE)).append(",");
          sb.append(baseDn);
          if (uid == null || uid.isEmpty() || password == null || password.isEmpty()) {
              return false;
          }
          try {
              Hashtable<String,String> environment = (Hashtable<String,String>) ctx.getEnvironment().clone();
              environment.put(Context.SECURITY_PRINCIPAL, sb.toString());
              environment.put(Context.SECURITY_CREDENTIALS, password);
              DirContext dirContext = new InitialDirContext(environment);
              dirContext.close();
              validationCount++;
              return true;
          } catch (NamingException ex) {
              handleNamingException("NamingException " + ex.getLocalizedMessage() + "\n", ex);
          }
          return false;
      }
docs: We use this method to check the given credentials to be valid. To prevent
  the check every action call, the result (if true) will be cached for 60s.
  
  @param uid the given uid.
  @param password the given password.
  @return true if credentials are valid, otherwise false.