[JIRA] [active-directory-plugin] (JENKINS-32710) Configure AD via Groovy

56 views
Skip to first unread message

jsmickey@gmail.com (JIRA)

unread,
Feb 1, 2016, 11:23:02 AM2/1/16
to jenkinsc...@googlegroups.com
John Mickey created an issue
 
Jenkins / Improvement JENKINS-32710
Configure AD via Groovy
Issue Type: Improvement Improvement
Assignee: Unassigned
Components: active-directory-plugin
Created: 01/Feb/16 4:22 PM
Priority: Minor Minor
Reporter: John Mickey

I am working on configuring Active Directory via Groovy.

I was able to authenticate via active directory via the UI.

I have the following based on the LDAP plugin:

    import jenkins.model.*
    import hudson.security.*
    import hudson.plugins.*

    String domain = 'my.domain.com'
    String server = '192.168.1.1'
    String bindName = 'acc...@my.domain.com'
    String bindPassword = 'password'

    SecurityRealm ad_realm = new ActiveDirectorySecurityRealm(domain, server, bindName, bindPassword)
    jenkins.instance.setSecurityRealm(ad_realm)

This is the error:

STDERR: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
           RemoteClass: 10: unable to resolve class ActiveDirectorySecurityRealm 
            @ line 10, column 26.
       SecurityRealm ad_realm = new ActiveDirectorySecurityRealm(domain, server, bindName, bindPassword)
                                ^
           
           1 error
           
           	at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:302)
           	at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:861)
           	at org.codehaus.groovy.control.CompilationUnit.doPhaseOperation(CompilationUnit.java:550)
           	at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:499)
           	at groovy.lang.GroovyClassLoader.doParseClass(GroovyClassLoader.java:302)
           	at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:281)
           	at groovy.lang.GroovyShell.parseClass(GroovyShell.java:731)
           	at groovy.lang.GroovyShell.run(GroovyShell.java:516)
           	at hudson.cli.GroovyCommand.run(GroovyCommand.java:86)
           	at hudson.cli.CLICommand.main(CLICommand.java:237)
           	at hudson.cli.CliManagerImpl.main(CliManagerImpl.java:92)
           	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
           	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
           	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
           	at java.lang.reflect.Method.invoke(Method.java:497)
           	at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvocationHandler.java:608)
           	at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:583)
           	at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocationHandler.java:542)
           	at hudson.remoting.UserRequest.perform(UserRequest.java:120)
           	at hudson.remoting.UserRequest.perform(UserRequest.java:48)
           	at hudson.remoting.Request$2.run(Request.java:326)
           	at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:68)
           	at hudson.cli.CliManagerImpl$1.call(CliManagerImpl.java:63)
           	at hudson.remoting.CallableDecoratorAdapter.call(CallableDecoratorAdapter.java:18)
           	at hudson.remoting.CallableDecoratorList$1.call(CallableDecoratorList.java:21)
           	at jenkins.util.ContextResettingExecutorService$2.call(ContextResettingExecutorService.java:46)
           	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
           	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
           	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
           	at java.lang.Thread.run(Thread.java:745)

How do I call the class? Am I on the right track? Any help is appreciated. I will post a working configuration before resolving the ticket.

Add Comment Add Comment
 
This message was sent by Atlassian JIRA (v6.4.2#64017-sha1:e244265)
Atlassian logo
Reply all
Reply to author
Forward
0 new messages