title: OpenLDAP - Get Password Attributes
body: <p>i am writing an OpenLdap controller, where i have a lot of ldap functions. One function is to get a LdapUser and his different attributes.</p>
  
  <p>For example:</p>
  
  <pre><code>    NamingEnumeration&lt;SearchResult&gt; enumResult = null;
      UserData ldapUser = new UserData();
  
      private String[] user_attributes = new String[]{"uid","cn", "sn", "dn", "description", "mail", "displayName",
          "userPassword","pwdChangedTime","pwdExpires", "lastLogonTime"};
  
      try
      {                  
          SearchControls searchCtrls = new SearchControls();
          searchCtrls.setSearchScope(SearchControls.SUBTREE_SCOPE);
          searchCtrls.setReturningAttributes(user_attributes);
  
  
          String filter = "(&amp;(objectClass=inetOrgPerson)(uid="+userUid+"))";
  
          enumResult = ctx.search(ou,filter,searchCtrls);
  
          SearchResult result = (SearchResult) enumResult.next();
  
  
          ldapUser.setUid(getAttribute(result,"uid"));    
          ldapUser.setCN(getAttribute(result, "cn"));
          ldapUser.setSN(getAttribute(result, "sn"));
          ldapUser.setGivenName(getAttribute(result, "givenName"));
          ldapUser.setDescription(getAttribute(result, "description"));
          ldapUser.setMail(getAttribute(result, "mail"));         
  
      }
  </code></pre>
  
  <p>That works fine. I have my ldapUser class fullfilled with the attributes. I did the same for a TDS Controller before, and there i could use even the following attributes:</p>
  
  <pre><code>        ldapUser.setPassword(getAttribute(result, "userPassword"));
          ldapUser.setpwdExpires(getAttribute(result,"pwdExpires"));
          ldapUser.setpwdChangedTime(getAttribute(result, "pwdChangedTime"));
          ldapUser.setlastLogonTime(getAttribute(result,"lastLogonTime"));
  </code></pre>
  
  <p>But it seems this doesn't work for OpenLdap anymore. Does anyone know or has a solution for getting these password attributes in java from OpenLdap?</p>
  
  <p>Best regards</p>