Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 368234

Summary: Username not passed to ldap when logging in via cli client
Product: [Technology] Hudson Reporter: Geoff Waymark <mygwaymark>
Component: CoreAssignee: Winston Prakash <winston.prakash>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description Geoff Waymark CLA 2012-01-10 06:36:02 EST
Build Identifier: #40 Eclipse build

D:\Hudson_Dev>java -jar hudson-cli.jar -s http://localhost:8080 login --username
 valid.username@company.com --password pa55word
java.lang.IllegalArgumentException: username must not be null
        at org.springframework.util.Assert.notNull(Assert.java:112)
        at org.springframework.security.userdetails.ldap.LdapUserDetailsImpl$Ess
ence.createUserDetails(LdapUserDetailsImpl.java:181)
        at hudson.security.LDAPSecurityRealm$LDAPUserDetailsService.loadUserByUs
ername(LDAPSecurityRealm.java:451)
        at hudson.security.LDAPSecurityRealm$LDAPUserDetailsService.loadUserByUs
ername(LDAPSecurityRealm.java:402)
        at hudson.security.LDAPSecurityRealm.loadUserByUsername(LDAPSecurityReal
m.java:361)
        at hudson.cli.ClientAuthenticationCache.set(ClientAuthenticationCache.ja
va:111)
        at hudson.cli.LoginCommand.run(LoginCommand.java:51)
        at hudson.cli.CLICommand.main(CLICommand.java:177)
        at hudson.cli.CliManagerImpl.main(CliManagerImpl.java:62)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        at hudson.remoting.RemoteInvocationHandler$RPCRequest.perform(RemoteInvo
cationHandler.java:270)
        at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocat
ionHandler.java:251)
        at hudson.remoting.RemoteInvocationHandler$RPCRequest.call(RemoteInvocat
ionHandler.java:211)
        at hudson.remoting.UserRequest.perform(UserRequest.java:107)
        at hudson.remoting.UserRequest.perform(UserRequest.java:41)
        at hudson.remoting.Request$2.run(Request.java:276)
        at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
        at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

Reproducible: Always

Steps to Reproduce:
1. Download hudson-cli.jar
2. Setup ldap authentication, with logged in users can do anything
3. Run a valid login cli command
Comment 1 Winston Prakash CLA 2012-01-10 18:12:59 EST
Fixed. http://git.eclipse.org/c/hudson/org.eclipse.hudson.core.git/commit/?id=a43044de43a70c05062d500a7024c060765823b8

I tested the CLI as following

- login using LDAP username & password. 
   java -jar hudson-cli.jar -s http://localhost:8080/ login --username wjprakash --password <password>
- Disable a job
  java -jar hudson-cli.jar -s http://localhost:8080/ disable-job test4
Comment 2 Geoff Waymark CLA 2012-01-13 09:42:19 EST
Tested against candidate M0