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

Unable to set "servers" option in the ActiveDirectory plugin through groovy

XMLWordPrintable

      Unable to set the "servers" option using groovy on the latest active_directory plugin 2.0. Groovy script used is :

      import jenkins.model.*
      import hudson.security.*
      import org.jenkinsci.plugins.*
      import hudson.plugins.*
        
      jenkins = jenkins.model.Jenkins.getInstance()
      
      adldapRealm = new hudson.plugins.active_directory.ActiveDirectorySecurityRealm(
        'domain', 
        'site',
        'bindname',
        'bindPassword',
        'servers'
      )
      jenkins.setSecurityRealm(adldapRealm)
      strategy = new FullControlOnceLoggedInAuthorizationStrategy()
      jenkins.setAuthorizationStrategy(strategy)
      jenkins.save()
      

      Resulting config:

        <authorizationStrategy class="hudson.security.AuthorizationStrategy$Unsecured"/>
        <securityRealm class="hudson.plugins.active_directory.ActiveDirectorySecurityRealm" plugin="active-directory@2.0">
          <domains>
            <hudson.plugins.active__directory.ActiveDirectoryDomain>
              <name>domain</name>
            </hudson.plugins.active__directory.ActiveDirectoryDomain>
          </domains>
          <site>site</site>
          <bindName>bindName</bindName>
          <bindPassword>bindPassword</bindPassword>
          <groupLookupStrategy>AUTO</groupLookupStrategy>
          <removeIrrelevantGroups>false</removeIrrelevantGroups>
        </securityRealm>
      

            fbelzunc FĂ©lix Belzunce Arcos
            plokhande Poornima Lokhande
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: