Hi Team,
I am configuring the Active directory authentication with the groovy script. As per the new plugin, I want to create an Active Directory authentication without requireTLS option. hence I am using the below constructor which is presented on the ActiveDirectorySecurityRealm. Even though I am passing all the values, it’s throwing an error saying “could not find matching constructor”. So can anyone please correct me if I am doing anything wrong?
Setup:
Jenkins LTS 2.363 container
Active Directory Plugin 2-25.1
I am using the below constructor from the active directory plugin:
you can find the same from this plugin git repo.
@DataBoundConstructor
// as Java signature, this binding doesn't make sense, so please don't use this constructor
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, ActiveDirectoryInternalUsersDatabase internalUsersDatabase, boolean requireTLS) {
if (customDomain!=null && !customDomain)
domains = null;
this.domain = fixEmpty(domain);
this.server = fixEmpty(server);
this.domains = domains;
this.site = fixEmpty(site);
this.bindName = fixEmpty(bindName);
this.bindPassword = Secret.fromString(fixEmpty(bindPassword));
this.groupLookupStrategy = groupLookupStrategy;
this.removeIrrelevantGroups = removeIrrelevantGroups;
this.cache = cache;
this.startTls = startTls;
this.internalUsersDatabase = internalUsersDatabase;
this.requireTLS = Boolean.valueOf(requireTLS);
}
Below is the groovy code:
String server = "192.168.1.1"
String domain = 'domain.com'
String site = 'site'
String bindName = 'user@google.com'
String bindPassword = 'password'
String GroupLookupStrategy = 'Automatic'
adrealm = new hudson.plugins.active_directory.ActiveDirectorySecurityRealm(domain, null, site, bindName, bindPassword, server, GroupLookupStrategy, false, false, null, true, null, false)
instance.setSecurityRealm(adrealm)
def strategy = new hudson.security.FullControlOnceLoggedInAuthorizationStrategy()
instance.setAuthorizationStrategy(strategy)
Below is the error which i am getting:
groovy.lang.GroovyRuntimeException: Could not find matching constructor for: hudson.plugins.active_directory.ActiveDirectorySecurityRealm(java.lang.String, null, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.String, java.lang.Boolean, java.lang.Boolean, null, java.lang.Boolean, null, java.lang.Boolean)