1
0
mirror of https://github.com/kataras/iris.git synced 2025-12-23 04:47:02 +00:00
Gerasimos Maropoulos
2016-07-20 20:23:54 +03:00
parent 72c5d2882b
commit 352b297977
2 changed files with 13 additions and 8 deletions

View File

@@ -267,13 +267,13 @@ type (
// sessionsManager implements the ISessionsManager interface
// contains the cookie's name, the provider and a duration for GC and cookie life expire
sessionsManager struct {
config config.Sessions
config *config.Sessions
provider *sessionProvider
}
)
// newSessionsManager creates & returns a new SessionsManager and start its GC
func newSessionsManager(c config.Sessions) *sessionsManager {
func newSessionsManager(c *config.Sessions) *sessionsManager {
if c.DecodeCookie {
c.Cookie = base64.URLEncoding.EncodeToString([]byte(c.Cookie)) // change the cookie's name/key to a more safe(?)
// get the real value for your tests by:
@@ -285,6 +285,11 @@ func newSessionsManager(c config.Sessions) *sessionsManager {
return manager
}
func (m *sessionsManager) registerDatabase(db SessionDatabase) {
m.provider.expires = m.config.Expires // updae the expires confiuration field for any case
m.provider.registerDatabase(db)
}
func (m *sessionsManager) generateSessionID() string {
return base64.URLEncoding.EncodeToString(utils.Random(32))
}