https://ci.jenkins-ci.org/job/jenkins_main_trunk/2602/testReport/junit/hudson.model/JobTest/readPermission/
com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException: 404 Not Found for http://localhost:47898/jenkins//j_acegi_security_check
at com.gargoylesoftware.htmlunit.WebClient.throwFailingHttpStatusCodeExceptionIfNecessary(WebClient.java:549)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:333)
at com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:357)
at com.gargoylesoftware.htmlunit.html.HtmlForm.submit(HtmlForm.java:196)
at org.jvnet.hudson.test.JenkinsRule$WebClient.login(JenkinsRule.java:1776)
at org.jvnet.hudson.test.JenkinsRule$WebClient.login(JenkinsRule.java:1788)
at hudson.model.JobTest.readPermission(JobTest.java:182)
java.lang.NullPointerException
at hudson.model.Run.getFullDisplayName(Run.java:711)
at hudson.model.Run.toString(Run.java:706)
at java.lang.String.valueOf(Unknown Source)
at java.lang.StringBuilder.append(Unknown Source)
at hudson.model.AbstractBuild.getPreviousBuild(AbstractBuild.java:218)
As Jesse pointed out, contextual information is often useful in authenticating the build, which means we need to take Queue.Item (initially AbstractBuild was the parameter, which provided the context, and I failed to accommodate that in transition to AbstractProject.)
To still allow Queue.Tasks to provide a meaningful value fallback to Queue.Task.getDefaultAuthentication() as opposed to hard code it to ACL.SYSTEM. This allow plugins like remote-terminal-access to supply a meaningful secure value without forcing a configuration change to the user.
This is necessary because a part of the access control is determining which Executor can accept which Queue.Task, so we can't have the authenticator taking Executor as a parameter.
I briefly thought about changing ExecutorAuthenticator to authenticate Queue.SubTask, but doing this intelligently is very difficult as an authenticator wouldn't really be able to make any sensible decisions unless it checks for specific subtypes (think of the dist-fork plugin and the remote terminal access plugin that implements Queue.Task.) So I made the change to have it accept AbstractProject, which is really the primary use case anyway.
The relevant classes are renamed to better represent what it does now.