Documentation ¶
Overview ¶
Package session contains session functions.
Index ¶
- func GetSession(r *http.Request) *sessions.CookieStore
- func ProtectedPage(next http.Handler) http.Handler
- func Root(r *http.Request) string
- func SessionDelete(w http.ResponseWriter, r *http.Request, key string)
- func SessionGetValue(r *http.Request, key string) (value int64, ok bool)
- func SessionRedirect(next http.Handler) http.Handler
- func SessionSetValue(w http.ResponseWriter, r *http.Request, key string, value int64)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetSession ¶
func GetSession(r *http.Request) *sessions.CookieStore
func ProtectedPage ¶
ProtectedPage makes sure that the user is logged in. Use on pages which need authentication or which have to deal with user structure later on.
func Root ¶
root returns HTTP request "root". For example, calling it with http.Request which has URL of /api/user/5348482a2142dfb84ca41085 would return "api". This function is used to route both JSON API and frontend requests in the same function.
func SessionDelete ¶
func SessionDelete(w http.ResponseWriter, r *http.Request, key string)
func SessionRedirect ¶
SessionRedirect in addition to sessionIsAlive makes HTTP redirection to user home. SessionRedirect is useful for redirecting from pages which are only visible when logged out, for example login and register pages.
func SessionSetValue ¶
Types ¶
This section is empty.