Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion internal/bootstrap/app_bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,13 @@ func (app *BootstrapApp) Setup() error {
}

// Get cookie domain
cookieDomain, err := utils.GetCookieDomain(app.context.appUrl)
cookieDomainResolver := utils.GetCookieDomain
if app.config.Auth.Standalone {
tlog.App.Info().Msg("Standalone mode enabled, automatic authentication for proxied apps will not work")
cookieDomainResolver = utils.GetStandaloneCookieDomain
}

cookieDomain, err := cookieDomainResolver(app.context.appUrl)

if err != nil {
return err
Expand Down
1 change: 1 addition & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ type AuthConfig struct {
IP IPConfig `description:"IP whitelisting config options." yaml:"ip"`
Users []string `description:"Comma-separated list of users (username:hashed_password)." yaml:"users"`
UsersFile string `description:"Path to the users file." yaml:"usersFile"`
Standalone bool `description:"Run in standalone mode, do not set cookies for subdomains." yaml:"standalone"`
SecureCookie bool `description:"Enable secure cookies." yaml:"secureCookie"`
SessionExpiry int `description:"Session expiry time in seconds." yaml:"sessionExpiry"`
SessionMaxLifetime int `description:"Maximum session lifetime in seconds." yaml:"sessionMaxLifetime"`
Expand Down
9 changes: 9 additions & 0 deletions internal/utils/app_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,15 @@ func GetCookieDomain(u string) (string, error) {
return domain, nil
}

func GetStandaloneCookieDomain(u string) (string, error) {
parsed, err := url.Parse(u)
if err != nil {
return "", err
}

return parsed.Hostname(), nil
}

func ParseFileToLine(content string) string {
lines := strings.Split(content, "\n")
users := make([]string, 0)
Expand Down
Loading