title: SpringBoot, how to Authenticate with LDAP without using ldif?
body: <p>I am trying out the LDAP Authentication example in SpringBoot <a href="https://spring.io/guides/gs/authenticating-ldap/" rel="noreferrer">here</a></p>
  
  <p>It is using the ldif approach which I think is not applicable to my requirements because our ldap admin wont tell me where to find the ldif that I need.
  Before springboot I used to use my own ldap implementation not using ldif.  Is there a way to validate not using ldif just the SECURITY_AUTHENTICATION.simple ?
  Below is how I do ldap security in basic Java no spring.  How do I do this in spring without using ldif just basic username password.</p>
  
  <pre><code>boolean isLdapRegistred(String username, String password) {
      boolean result = false;
      try {
  
          Hashtable&lt;String, String&gt; env = new Hashtable&lt;String, String&gt;();
          env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
          env.put(Context.PROVIDER_URL, "ldap://10.x.x.x:389");           
          env.put(Context.SECURITY_AUTHENTICATION, "simple");         
          env.put(Context.SECURITY_PRINCIPAL, "OUR-DOMAIN\\" + username);
          env.put(Context.SECURITY_CREDENTIALS, password);
  
          // Create the initial context
          DirContext ctx = new InitialDirContext(env);
          result = ctx != null;
          if (ctx != null)
          ctx.close();
          System.out.println(result);
          return result;
      } catch (Exception e) {
          System.out.println("oops");
          return result;
      }
  
  }
  </code></pre>
  
  <p>Below is SpringBoots example need to use my credentials instead of ldif.</p>
  
  <pre><code>@Configuration
  protected static class AuthenticationConfiguration extends
          GlobalAuthenticationConfigurerAdapter {
  
      @Override
      public void init(AuthenticationManagerBuilder auth) throws Exception {
          auth
              .ldapAuthentication()
                  .userDnPatterns("uid={0},ou=people")
                  .groupSearchBase("ou=groups")
                  .contextSource().ldif("classpath:test-server.ldif");
      }
  }
  </code></pre>