ActiveDirectorySecurityRealm constructor ignores TlsConfiguration

This issue is archived. You can view it, but you can't modify it. Learn more

XMLWordPrintable

      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

       

       

       

       

            Assignee:
            Félix Belzunce Arcos
            Reporter:
            Ryan Thornton
            Archiver:
            Jenkins Service Account

              Created:
              Updated:
              Resolved:
              Archived: