docs: @SuppressWarnings("unchecked")
      private String getUserCredentials(String username) throws LoginException {
          String ldapCredential = null;
  
          SearchControls ctls = new SearchControls();
          ctls.setCountLimit(1);
          ctls.setDerefLinkFlag(true);
          ctls.setSearchScope(SearchControls.SUBTREE_SCOPE);
  
  
          try {
              Object[] filterArguments = { _userObjectClass, _userIdAttribute, username };
              NamingEnumeration results = _rootContext.search(_userBaseDn, OBJECT_CLASS_FILTER, filterArguments, ctls);
  
              LOG.debug("Found user?: " + results.hasMoreElements());
  
              if (!results.hasMoreElements()) {
                  throw new LoginException("User not found.");
              }
  
              SearchResult result = findUser(username);
  
              Attributes attributes = result.getAttributes();
  
              setDemographicAttributes(attributes);
              Attribute attribute = attributes.get(_userPasswordAttribute);
              if (attribute != null) {
                  try {
                      byte[] value = (byte[]) attribute.get();
  
                      ldapCredential = new String(value);
                  } catch (NamingException e) {
                      LOG.debug("no password available under attribute: " + _userPasswordAttribute);
                  }
              }
          } catch (NamingException e) {
              throw new LoginException("Root context binding failure.");
          }
  
          LOG.debug("user cred is present: " + (ldapCredential != null));
  
          return ldapCredential;
      }