feat: make http session cookie path & duration configurable (fixes #10522) (#10632)

Signed-off-by: Vikram Vaswani <2571660+vvaswani@users.noreply.github.com>
Signed-off-by: Jakob Borg <jakob@kastelo.net>
Co-authored-by: Jakob Borg <jakob@kastelo.net>
This commit is contained in:
vvaswani
2026-04-26 07:59:24 +00:00
committed by GitHub
co-authored by Jakob Borg
parent 1f57187461
commit 987e631176
5 changed files with 124 additions and 17 deletions
+8
View File
@@ -33,6 +33,8 @@ type GUIConfiguration struct {
InsecureSkipHostCheck bool `json:"insecureSkipHostcheck" xml:"insecureSkipHostcheck,omitempty"`
InsecureAllowFrameLoading bool `json:"insecureAllowFrameLoading" xml:"insecureAllowFrameLoading,omitempty"`
SendBasicAuthPrompt bool `json:"sendBasicAuthPrompt" xml:"sendBasicAuthPrompt,attr"`
SessionCookieDurationS int `json:"sessionCookieDurationS" xml:"sessionCookieDurationS,omitempty" default:"604800"`
SessionCookiePath string `json:"sessionCookiePath" xml:"sessionCookiePath,omitempty" default:"/"`
}
func (c GUIConfiguration) IsAuthEnabled() bool {
@@ -176,6 +178,12 @@ func (c *GUIConfiguration) prepare() {
if c.APIKey == "" {
c.APIKey = rand.String(32)
}
if path := strings.TrimSpace(c.SessionCookiePath); path != "" {
if !strings.HasPrefix(path, "/") {
path = "/" + path
}
c.SessionCookiePath = path
}
}
func (c GUIConfiguration) Copy() GUIConfiguration {