Path: blob/main/install/installer/pkg/components/auth/config.go
2501 views
// Copyright (c) 2023 Gitpod GmbH. All rights reserved.1// Licensed under the GNU Affero General Public License (AGPL).2// See License.AGPL.txt in the project root for license information.34package auth56import (7"fmt"8"time"910"github.com/gitpod-io/gitpod/installer/pkg/common"11server_lib "github.com/gitpod-io/gitpod/server/go/pkg/lib"12corev1 "k8s.io/api/core/v1"13)1415type Config struct {16PKI PKIConfig `json:"pki"`1718// Configration parameters for user sessions19Session SessionConfig `json:"session"`20}2122type SessionConfig struct {23// How long shoud the session be valid for?24LifetimeSeconds int64 `json:"lifetimeSeconds"`25Issuer string `json:"issuer"`26Cookie CookieConfig `json:"cookie"`27}2829type CookieConfig struct {30Name string `json:"name"`31MaxAge int64 `json:"maxAge"`32SameSite string `json:"sameSite"`33Secure bool `json:"secure"`34HTTPOnly bool `json:"httpOnly"`35}3637func GetConfig(ctx *common.RenderContext) ([]corev1.Volume, []corev1.VolumeMount, Config) {38volumes, mounts, pki := getPKI()39lifetime := int64((7 * 24 * time.Hour).Seconds())40return volumes, mounts, Config{41PKI: pki,42Session: SessionConfig{43LifetimeSeconds: lifetime,44Issuer: fmt.Sprintf("https://%s", ctx.Config.Domain),45Cookie: CookieConfig{46// Caution: changing these have security implications for the application. Make sure you understand what you're doing.47Name: server_lib.CookieNameFromDomain(ctx.Config.Domain),48MaxAge: lifetime,49SameSite: "lax",50Secure: true,51HTTPOnly: true,52},53},54}55}565758