csrf: able to set custom cookie name

Add new config option '[session] CSRF_COOKIE_NAME'.
This commit is contained in:
Unknwon
2017-02-22 21:46:43 -05:00
parent 28983c94ff
commit 054e97d614
5 changed files with 9 additions and 6 deletions

View File

@@ -187,7 +187,7 @@ var (
// Session settings
SessionConfig session.Options
CSRFCookieName = "_csrf"
CSRFCookieName string
// Cron tasks
Cron struct {
@@ -744,6 +744,7 @@ func newSessionService() {
SessionConfig.Secure = Cfg.Section("session").Key("COOKIE_SECURE").MustBool()
SessionConfig.Gclifetime = Cfg.Section("session").Key("GC_INTERVAL_TIME").MustInt64(86400)
SessionConfig.Maxlifetime = Cfg.Section("session").Key("SESSION_LIFE_TIME").MustInt64(86400)
CSRFCookieName = Cfg.Section("session").Key("CSRF_COOKIE_NAME").MustString("_csrf")
log.Info("Session Service Enabled")
}