I know how to use gorilla to manage sessions. But what I'm trying to accomplish is to set the session expiry time to a later date at run time, depending upon various application conditions. I haven't been able to figure out how to update this expiry time.
Consider the following code fragment ...
skey := "some sort of secret key"
sname := "some sort of session name"
session_store := sessions.NewCookieStore([]byte(skey))
session_store.Options = &sessions.Options{
MaxAge: 300,
}
// `r` is previously defined as the current *http.Request
sess, err := session_store.Get(r, sname)
As written, sess
will expire 300 seconds after it was initialized. But how can I extend the lifetime of sess
before this much time passes, so that its expiry will then occur at a later time?
Thank you in advance.
func (ms *MongoStore) Save(r *http.Request, w http.ResponseWriter, session *sessions.Session) error { ...
// update cookie encoded, err := securecookie.EncodeMulti(session.Name(), session.ID, ms.Codecs...) if err != nil { return err } http.SetCookie(w, sessions.NewCookie(session.Name(), encoded, session.Options))
...
return nil}
--
You received this message because you are subscribed to the Google Groups "Gorilla web toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gorilla-web...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gorilla-web/7f3e38bc-8e84-49fb-a42c-27849725b190%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Gorilla web toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gorilla-web...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gorilla-web/10c6f52b-db4a-4a46-b7ca-3be08d5b0781%40googlegroups.com.
sess, err := session_store.Get(r, sname)
I specifically want to query sess to find either its expiration time or the amount of time remaining before expiry.
--
You received this message because you are subscribed to the Google Groups "Gorilla web toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gorilla-web...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gorilla-web/b61b35cd-fdd2-4cef-b7be-7412f9e66c73%40googlegroups.com.
Can you expand on _why_ you want that functionality?
--
You received this message because you are subscribed to the Google Groups "Gorilla web toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gorilla-web...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gorilla-web/29481352-9553-48a3-8b56-8650834b405c%40googlegroups.com.