1
0
Fork 0
mirror of https://github.com/Luzifer/nginx-sso.git synced 2024-12-20 04:41:17 +00:00

[#41] Set default cookie values in all providers (#45)

Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
Knut Ahlers 2019-06-29 12:40:39 +02:00 committed by GitHub
parent b84a79ed21
commit 09cf06c905
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 18 additions and 2 deletions

View file

@ -73,8 +73,7 @@ func init() {
} }
// Set sane defaults for main configuration // Set sane defaults for main configuration
mainCfg.Cookie.Prefix = "nginx-sso" mainCfg.Cookie = plugins.DefaultCookieConfig()
mainCfg.Cookie.Expire = 3600
mainCfg.Listen.Addr = "127.0.0.1" mainCfg.Listen.Addr = "127.0.0.1"
mainCfg.Listen.Port = 8082 mainCfg.Listen.Port = 8082
mainCfg.Login.DefaultRedirect = "debug" mainCfg.Login.DefaultRedirect = "debug"

View file

@ -64,6 +64,8 @@ func (a *AuthGoogleOAuth) Configure(yamlSource []byte) (err error) {
} `yaml:"providers"` } `yaml:"providers"`
}{} }{}
envelope.Cookie = plugins.DefaultCookieConfig()
if err := yaml.Unmarshal(yamlSource, &envelope); err != nil { if err := yaml.Unmarshal(yamlSource, &envelope); err != nil {
return err return err
} }

View file

@ -62,6 +62,8 @@ func (a *AuthLDAP) Configure(yamlSource []byte) error {
} `yaml:"providers"` } `yaml:"providers"`
}{} }{}
envelope.Cookie = plugins.DefaultCookieConfig()
if err := yaml.Unmarshal(yamlSource, &envelope); err != nil { if err := yaml.Unmarshal(yamlSource, &envelope); err != nil {
return err return err
} }

View file

@ -67,6 +67,8 @@ func (a *AuthOIDC) Configure(yamlSource []byte) (err error) {
} `yaml:"providers"` } `yaml:"providers"`
}{} }{}
envelope.Cookie = plugins.DefaultCookieConfig()
if err := yaml.Unmarshal(yamlSource, &envelope); err != nil { if err := yaml.Unmarshal(yamlSource, &envelope); err != nil {
return err return err
} }

View file

@ -45,6 +45,8 @@ func (a *AuthSimple) Configure(yamlSource []byte) error {
} `yaml:"providers"` } `yaml:"providers"`
}{} }{}
envelope.Cookie = plugins.DefaultCookieConfig()
if err := yaml.Unmarshal(yamlSource, &envelope); err != nil { if err := yaml.Unmarshal(yamlSource, &envelope); err != nil {
return err return err
} }

View file

@ -44,6 +44,8 @@ func (a *AuthYubikey) Configure(yamlSource []byte) error {
} `yaml:"providers"` } `yaml:"providers"`
}{} }{}
envelope.Cookie = plugins.DefaultCookieConfig()
if err := yaml.Unmarshal(yamlSource, &envelope); err != nil { if err := yaml.Unmarshal(yamlSource, &envelope); err != nil {
return err return err
} }

View file

@ -19,3 +19,10 @@ func (c CookieConfig) GetSessionOpts() *sessions.Options {
HttpOnly: true, HttpOnly: true,
} }
} }
func DefaultCookieConfig() CookieConfig {
return CookieConfig{
Prefix: "nginx-sso",
Expire: 3600,
}
}