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

ActiveDirectorySecurityRealm constructor ignores TlsConfiguration

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • Active Directory Plugin 2.6

      Hello,

      I'm attempting to configure the Active Directory Plugin programmatically in a Packer template and it appears I'm unable to select the  "JDK_TRUSTSTORE" when using the available ActiveDirectorySecurityRealm constructors.

      For example, doing this:

       

      // sample groovy configuration script
      def instance = Jenkins.getInstance()
      def ad_realm = new ActiveDirectorySecurityRealm(domain,
          domains, // List<ActiveDirectoryDomain>
          site,
          bindName,
          bindPassword,
          server,
          GroupLookupStrategy.RECURSIVE,
          false,	// Boolean removeIrrelevantGroups
          domain != null, // Boolean customDomain
          null, // CacheConfiguration cache,
          true, // Boolean startTls
          TlsConfiguration.JDK_TRUSTSTORE)
      instance.setSecurityRealm(ad_realm)
      instance.save()

      Results in a new AD Domain being added, but it's still listed as "(Unsecure) Trust all Certificates" even though I passed in a setting that should pick the "JDK TrustStore".

      It looks like the constructor is ignoring the passed in TlsConfiguration object and always choosing TRUST_ALL_CERTIFICATES regardless of what the user passes in.

      public ActiveDirectorySecurityRealm(String domain, List<ActiveDirectoryDomain> domains, String site, String bindName,
      String bindPassword, String server, GroupLookupStrategy groupLookupStrategy, boolean removeIrrelevantGroups, Boolean customDomain, CacheConfiguration cache, Boolean startTls, TlsConfiguration tlsConfiguration) {
      this(domain, domains, site, bindName, bindPassword, server, groupLookupStrategy, removeIrrelevantGroups, customDomain, cache, startTls, TlsConfiguration.TRUST_ALL_CERTIFICATES, null);
      }
      

       

      It looks like this constructor was introduced here:
      FIXED JENKINS-39065

       

       

       

       

            fbelzunc Félix Belzunce Arcos
            thorntonryan Ryan Thornton
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: