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

    LdapEntry userEntry = authenticate(username, password);
    if (userEntry == null) {
      return false;
    }
    // If authenticated by LDAP server, the returned LdapEntry contains full DN of the user
    String userDn = userEntry.getDn();

    if(userDn == null){
      // This shouldn't happen if LDAP server is configured properly.
      LOG.error("userDn is found null for the user {}", username);
      return false;
    }

    List<String> roles = getUserRoles(username, userDn);
    //Authentication already succeeded. We won't store user password so passing empty credential
    UserInfo userInfo = new UserInfo(username, Credential.getCredential(""), roles);
    JAASUserInfo jaasUserInfo = new JAASUserInfo(userInfo);
    jaasUserInfo.fetchRoles();
    setCurrentUser(jaasUserInfo);
    setAuthenticated(true);

    return true;
  }
public boolean bindingLogin(String username, Object password) throws Exception {
    if (StringUtils.isBlank(_userObjectClass)|| StringUtils.isBlank(_userIdAttribute)
        || StringUtils.isBlank(_userBaseDn)){
      LOG.error("Failed to get user because at least one of the following is null : " +
          "[_userObjectClass, _userIdAttribute, _userBaseDn ]");
      return false;
    }

    LdapEntry userEntry = authenticate(username, password);
    if (userEntry == null) {
      return false;
    }
    // If authenticated by LDAP server, the returned LdapEntry contains full DN of the user
    String userDn = userEntry.getDn();

    if(userDn == null){
      // This shouldn't happen if LDAP server is configured properly.
      LOG.error("userDn is found null for the user {}", username);
      return false;
    }

    List<String> roles = getUserRoles(username, userDn);
    //Authentication already succeeded. We won't store user password so passing empty credential
    UserInfo userInfo = new UserInfo(username, Credential.getCredential(""), roles);
    JAASUserInfo jaasUserInfo = new JAASUserInfo(userInfo);
    jaasUserInfo.fetchRoles();
    setCurrentUser(jaasUserInfo);
    setAuthenticated(true);

    return true;
  }
public boolean bindingLogin ( String username , Object password ) throws Exception { if ( StringUtils . isBlank ( _userObjectClass ) || StringUtils . isBlank ( _userIdAttribute ) || StringUtils . isBlank ( _userBaseDn ) ) { LOG . error ( "Failed to get user because at least one of the following is null : " + "[_userObjectClass, _userIdAttribute, _userBaseDn ]" ) ; return false ; } LdapEntry userEntry = authenticate ( username , password ) ; if ( userEntry == null ) { return false ; } // If authenticated by LDAP server, the returned LdapEntry contains full DN of the user String userDn = userEntry . getDn ( ) ; if ( userDn == null ) { // This shouldn't happen if LDAP server is configured properly. LOG . error ( "userDn is found null for the user {}" , username ) ; return false ; } List < String > roles = getUserRoles ( username , userDn ) ; //Authentication already succeeded. We won't store user password so passing empty credential UserInfo userInfo = new UserInfo ( username , Credential . getCredential ( "" ) , roles ) ; JAASUserInfo jaasUserInfo = new JAASUserInfo ( userInfo ) ; jaasUserInfo . fetchRoles ( ) ; setCurrentUser ( jaasUserInfo ) ; setAuthenticated ( true ) ; return true ; }
binding authentication check
This method of authentication works only if the user branch of the DIT (ldap tree)
has an ACI (access control instruction) that allow the access to any user or at least
for the user that logs in.

@param username
@param password
@return true always
@throws LoginException
binding authentication check This method of authentication works only if the user branch of the DIT ( ldap tree ) has an ACI ( access control instruction ) that allow the access to any user or at least for the user that logs in .