2019-04-21 14:58:06 +00:00
|
|
|
package plugins
|
|
|
|
|
|
|
|
import "github.com/gorilla/sessions"
|
|
|
|
|
|
|
|
type CookieConfig struct {
|
|
|
|
Domain string `yaml:"domain"`
|
|
|
|
AuthKey string `yaml:"authentication_key"`
|
|
|
|
Expire int `yaml:"expire"`
|
|
|
|
Prefix string `yaml:"prefix"`
|
|
|
|
Secure bool `yaml:"secure"`
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c CookieConfig) GetSessionOpts() *sessions.Options {
|
|
|
|
return &sessions.Options{
|
|
|
|
Path: "/",
|
|
|
|
Domain: c.Domain,
|
|
|
|
MaxAge: c.Expire,
|
|
|
|
Secure: c.Secure,
|
|
|
|
HttpOnly: true,
|
|
|
|
}
|
|
|
|
}
|
2019-06-29 10:40:39 +00:00
|
|
|
|
|
|
|
func DefaultCookieConfig() CookieConfig {
|
|
|
|
return CookieConfig{
|
|
|
|
Prefix: "nginx-sso",
|
|
|
|
Expire: 3600,
|
|
|
|
}
|
|
|
|
}
|