Skip to content
Permalink
Browse files
[FIXED JENKINS-44010] It is possible for Jenkins.crumbIssuer to be un…
…set while the setup wizard is running.
  • Loading branch information
jglick committed May 3, 2017
1 parent b5ee2a0 commit ae1fdc95a1d50df65a97447ff536d21cb2c5dba2
@@ -254,7 +254,10 @@ public HttpResponse doCreateAdminUser(StaplerRequest req, StaplerResponse rsp) t
a = securityRealm.getSecurityComponents().manager.authenticate(a);
SecurityContextHolder.getContext().setAuthentication(a);
CrumbIssuer crumbIssuer = Jenkins.getInstance().getCrumbIssuer();
JSONObject data = new JSONObject().accumulate("crumbRequestField", crumbIssuer.getCrumbRequestField()).accumulate("crumb", crumbIssuer.getCrumb(req));
JSONObject data = new JSONObject();
if (crumbIssuer != null) {
data.accumulate("crumbRequestField", crumbIssuer.getCrumbRequestField()).accumulate("crumb", crumbIssuer.getCrumb(req));
}
return HttpResponses.okJSON(data);
} else {
return HttpResponses.okJSON();
@@ -3673,6 +3673,7 @@ public synchronized void doConfigSubmit( StaplerRequest req, StaplerResponse rsp
*
* @return null if none is in use.
*/
@CheckForNull
public CrumbIssuer getCrumbIssuer() {
return crumbIssuer;
}

0 comments on commit ae1fdc9

Please sign in to comment.