Skip to content

Commit

Permalink
Add an option for crumbIssue session id to center start command (#545)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinuxSuRen authored Mar 12, 2021
1 parent f60a6aa commit 26d3a58
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions app/cmd/center_start.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ type CenterStartOption struct {
SetupWizard bool
AdminCanGenerateNewTokens bool
CleanHome bool
CrumbExcludeSessionID bool

// comes from folder plugin
ConcurrentIndexing int
Expand Down Expand Up @@ -75,6 +76,8 @@ func init() {
i18n.T("System property key-value"))
flags.BoolVarP(&centerStartOption.SetupWizard, "setup-wizard", "", true,
i18n.T("If you want to show the setup wizard at first start"))
flags.BoolVarP(&centerStartOption.CrumbExcludeSessionID, "crumb-exclude-sessionId", "", false,
i18n.T(`Add system properties with 'hudson.security.csrf.DefaultCrumbIssuer.EXCLUDE_SESSION_ID=true'`))
flags.BoolVarP(&centerStartOption.AdminCanGenerateNewTokens, "admin-can-generate-new-tokens", "", false,
i18n.T("If enabled, the users with administer permissions can generate new tokens for other users"))
flags.BoolVarP(&centerStartOption.CleanHome, "clean-home", "", false,
Expand Down Expand Up @@ -317,6 +320,10 @@ func (c *CenterStartOption) setSystemProperty(jenkinsWarArgs []string) []string
c.System = append(c.System, fmt.Sprintf("com.cloudbees.hudson.plugins.folder.computed.ThrottleComputationQueueTaskDispatcher.LIMIT=%d", c.ConcurrentIndexing))
}

if c.CrumbExcludeSessionID {
c.System = append(c.System, "hudson.security.csrf.DefaultCrumbIssuer.EXCLUDE_SESSION_ID=true")
}

for _, item := range centerStartOption.System {
jenkinsWarArgs = append(jenkinsWarArgs, fmt.Sprintf("-D%s", item))
}
Expand Down

0 comments on commit 26d3a58

Please sign in to comment.