Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-6550

add flexiblity to LDAP search attribute, instead of just attribute=username, complete filter can be defined.

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Major Major
    • ldapemail-plugin
    • None

      LDAP Email Plugin requires the search attribute must be formatted to 'attribute=value'.

      I would like more options for selection of LDAP search attribute.

      Example search attribute : (&(ID=%s)(cn=prefix*))

      The 'LdapMailAddressResolver' requires one simple change to support this. Instead of "search attribute" being the attribute, it is an LDAP filter with %s entered for where userName is to be inserted.

      private String performSearch(DirContext ctx, String userName) throws NamingException {
      String emailAddress = null;
      SearchControls controls = new SearchControls();
      controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
      //String filter = String.format("%s=%s", configuration.getSearchAttribute(), userName);
      String filter = String.format(configuration.getSearchAttribute(), userName);

          [JENKINS-6550] add flexiblity to LDAP search attribute, instead of just attribute=username, complete filter can be defined.

          buesing created issue -
          buesing made changes -
          Issue Type Original: Bug [ 1 ] New: Improvement [ 4 ]
          buesing made changes -
          Description Original: LDAP Email Plugin requires the search attribute must be formatted to 'attribute=value'.

          I would like more attitude in for selection of LDAP search attribute.

          Example search attribute : (&(ID=%s)(cn=prefix*))

          The 'LdapMailAddressResolver' requires one simple change to support this. Instead of "search attribute" being the attribute, it is an LDAP filter with %s entered for where userName is to be inserted.

              private String performSearch(DirContext ctx, String userName) throws NamingException {
                  String emailAddress = null;
                  SearchControls controls = new SearchControls();
                  controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
                  //String filter = String.format("%s=%s", configuration.getSearchAttribute(), userName);
                  String filter = String.format(configuration.getSearchAttribute(), userName);



          New: LDAP Email Plugin requires the search attribute must be formatted to 'attribute=value'.

          I would like more options for selection of LDAP search attribute.

          Example search attribute : (&(ID=%s)(cn=prefix*))

          The 'LdapMailAddressResolver' requires one simple change to support this. Instead of "search attribute" being the attribute, it is an LDAP filter with %s entered for where userName is to be inserted.

              private String performSearch(DirContext ctx, String userName) throws NamingException {
                  String emailAddress = null;
                  SearchControls controls = new SearchControls();
                  controls.setSearchScope(SearchControls.SUBTREE_SCOPE);
                  //String filter = String.format("%s=%s", configuration.getSearchAttribute(), userName);
                  String filter = String.format(configuration.getSearchAttribute(), userName);



          ziraldo made changes -
          Attachment New: ldapemail.patch [ 19666 ]
          R. Tyler Croy made changes -
          Workflow Original: JNJira [ 136645 ] New: JNJira + In-Review [ 174534 ]

            justinedelson justinedelson
            buesing buesing
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated: