Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[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 543d184
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
5 changes: 4 additions & 1 deletion core/src/main/java/jenkins/install/SetupWizard.java
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions core/src/main/java/jenkins/model/Jenkins.java
Expand Up @@ -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;
}
Expand Down

0 comments on commit 543d184

Please sign in to comment.