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.

(cherry picked from commit ae1fdc9)
  • Loading branch information
jglick authored and olivergondza committed May 11, 2017
1 parent e91a82d commit 543d184004e175da1efca68d9769eaa838763606
@@ -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();
@@ -3664,6 +3664,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 543d184

Please sign in to comment.