Possibilité de configurer les options du cookie

This commit is contained in:
wpetit 2020-10-13 14:59:25 +02:00
parent d4ca478b44
commit 4ee3de773c
2 changed files with 3 additions and 1 deletions

View File

@ -79,8 +79,9 @@ func getServiceContainer(ctx context.Context, conf *config.Config) (*service.Con
// Define default cookie options
sessionStore.SessionOpts.Path = "/"
sessionStore.SessionOpts.HttpOnly = true
sessionStore.SessionOpts.Secure = conf.HTTP.CookieSecure
sessionStore.SessionOpts.MaxAge = conf.HTTP.CookieMaxAge
sessionStore.SessionOpts.SameSite = http.SameSiteStrictMode
sessionStore.SessionOpts.SameSite = http.SameSiteLaxMode
ctn.Provide(
session.ServiceName,

View File

@ -47,6 +47,7 @@ type HTTPConfig struct {
CookieAuthenticationKey string `yaml:"cookieAuthenticationKey" env:"HTTP_COOKIE_AUTHENTICATION_KEY"`
CookieEncryptionKey string `yaml:"cookieEncryptionKey" env:"HTTP_COOKIE_ENCRYPTION_KEY"`
CookieMaxAge int `yaml:"cookieMaxAge" env:"HTTP_COOKIE_MAX_AGE"`
CookieSecure bool `yaml:"cookieSecure" env:"HTTP_COOKIE_SECURE"`
TemplateDir string `yaml:"templateDir" env:"HTTP_TEMPLATE_DIR"`
PublicDir string `yaml:"publicDir" env:"HTTP_PUBLIC_DIR"`
FrontendURL string `yaml:"frontendURL" env:"HTTP_FRONTEND_URL"`