container-common/src/main/java/com/streamsets/datacollector/http/LdapLoginModule.java
private LdapEntry getEntryWithCredential(String username) throws LdapException
  {
    if (StringUtils.isBlank(_userObjectClass)|| StringUtils.isBlank(_userIdAttribute)
        || StringUtils.isBlank(_userBaseDn) || StringUtils.isBlank(_userPasswordAttribute)){
      LOG.error("Failed to get user because at least one of the following is null : " +
          "[_userObjectClass, _userIdAttribute, _userBaseDn, _userPasswordAttribute ]");
      return null;
    }

    // Create the format of &(objectClass=_userObjectClass)(_userIdAttribute={user}))
    String userFilter = buildFilter(_userFilter, _userObjectClass, _userIdAttribute);
    if (userFilter.contains("{user}")){
      userFilter = userFilter.replace("{user}", username);
    }
    LOG.debug("Searching user using the filter {} on user baseDn {}", userFilter, _userBaseDn);

    // Get the group names from each group, which is obtained from roleNameAttribute attribute.
    SearchRequest request = new SearchRequest(_userBaseDn, userFilter, _userPasswordAttribute);
    request.setSearchScope(SearchScope.SUBTREE);
    request.setSizeLimit(1);

    try {
      SearchOperation search = new SearchOperation(conn);
      org.ldaptive.SearchResult result = search.execute(request).getResult();
      LdapEntry entry = result.getEntry();
      LOG.info("Found user?: {}", entry != null);
      return entry;
    } catch (LdapException ex) {
      LOG.error("{}", ex.toString(), ex);
      return null;
    }
  }
private LdapEntry getEntryWithCredential(String username) throws LdapException
  {
    if (StringUtils.isBlank(_userObjectClass)|| StringUtils.isBlank(_userIdAttribute)
        || StringUtils.isBlank(_userBaseDn) || StringUtils.isBlank(_userPasswordAttribute)){
      LOG.error("Failed to get user because at least one of the following is null : " +
          "[_userObjectClass, _userIdAttribute, _userBaseDn, _userPasswordAttribute ]");
      return null;
    }

    // Create the format of &(objectClass=_userObjectClass)(_userIdAttribute={user}))
    String userFilter = buildFilter(_userFilter, _userObjectClass, _userIdAttribute);
    if (userFilter.contains("{user}")){
      userFilter = userFilter.replace("{user}", username);
    }
    LOG.debug("Searching user using the filter {} on user baseDn {}", userFilter, _userBaseDn);

    // Get the group names from each group, which is obtained from roleNameAttribute attribute.
    SearchRequest request = new SearchRequest(_userBaseDn, userFilter, _userPasswordAttribute);
    request.setSearchScope(SearchScope.SUBTREE);
    request.setSizeLimit(1);

    try {
      SearchOperation search = new SearchOperation(conn);
      org.ldaptive.SearchResult result = search.execute(request).getResult();
      LdapEntry entry = result.getEntry();
      LOG.info("Found user?: {}", entry != null);
      return entry;
    } catch (LdapException ex) {
      LOG.error("{}", ex.toString(), ex);
      return null;
    }
  }
private LdapEntry getEntryWithCredential ( String username ) throws LdapException { if ( StringUtils . isBlank ( _userObjectClass ) || StringUtils . isBlank ( _userIdAttribute ) || StringUtils . isBlank ( _userBaseDn ) || StringUtils . isBlank ( _userPasswordAttribute ) ) { LOG . error ( "Failed to get user because at least one of the following is null : " + "[_userObjectClass, _userIdAttribute, _userBaseDn, _userPasswordAttribute ]" ) ; return null ; } // Create the format of &(objectClass=_userObjectClass)(_userIdAttribute={user})) String userFilter = buildFilter ( _userFilter , _userObjectClass , _userIdAttribute ) ; if ( userFilter . contains ( "{user}" ) ) { userFilter = userFilter . replace ( "{user}" , username ) ; } LOG . debug ( "Searching user using the filter {} on user baseDn {}" , userFilter , _userBaseDn ) ; // Get the group names from each group, which is obtained from roleNameAttribute attribute. SearchRequest request = new SearchRequest ( _userBaseDn , userFilter , _userPasswordAttribute ) ; request . setSearchScope ( SearchScope . SUBTREE ) ; request . setSizeLimit ( 1 ) ; try { SearchOperation search = new SearchOperation ( conn ) ; org . ldaptive . SearchResult result = search . execute ( request ) . getResult ( ) ; LdapEntry entry = result . getEntry ( ) ; LOG . info ( "Found user?: {}" , entry != null ) ; return entry ; } catch ( LdapException ex ) { LOG . error ( "{}" , ex . toString ( ) , ex ) ; return null ; } }
attempts to get the users credentials from the users context
<p/>
NOTE: this is not an user authenticated operation

@param username
@return
@throws LoginException
attempts to get the users credentials from the users context <p / > NOTE : this is not an user authenticated operation