container-common/src/main/java/com/streamsets/datacollector/http/LdapLoginModule.java
@VisibleForTesting
  static String buildFilter(String attrFilter, String objClass, String attrName){
    // check if the filter has surrounding "()"
    if(!attrFilter.startsWith("(")){
      attrFilter = "(" + attrFilter;
    }
    if (!attrFilter.endsWith(")")) {
      attrFilter = attrFilter + ")";
    }
    return String.format(filterFormat, objClass, String.format(attrFilter, attrName));
  }
@VisibleForTesting
  static String buildFilter(String attrFilter, String objClass, String attrName){
    // check if the filter has surrounding "()"
    if(!attrFilter.startsWith("(")){
      attrFilter = "(" + attrFilter;
    }
    if (!attrFilter.endsWith(")")) {
      attrFilter = attrFilter + ")";
    }
    return String.format(filterFormat, objClass, String.format(attrFilter, attrName));
  }
@ VisibleForTesting static String buildFilter ( String attrFilter , String objClass , String attrName ) { // check if the filter has surrounding "()" if ( ! attrFilter . startsWith ( "(" ) ) { attrFilter = "(" + attrFilter ; } if ( ! attrFilter . endsWith ( ")" ) ) { attrFilter = attrFilter + ")" ; } return String . format ( filterFormat , objClass , String . format ( attrFilter , attrName ) ) ; }
Given a filter(user/role filter), replace attributes using given information from config.
This will create complete filter, which will look like &(objectClass=inetOrgPerson)(uid={user}))
@param attrFilter We obtain this part from config
@param objClass objectClass
@param attrName attribute name
@return Complete filter
Given a filter ( user / role filter ) replace attributes using given information from config . This will create complete filter which will look like & ( objectClass = inetOrgPerson ) ( uid = { user } ))