session

package
v0.0.0-...-254fdf3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2017 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package session contains session functions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetSession

func GetSession(r *http.Request) *sessions.CookieStore

func ProtectedPage

func ProtectedPage(next http.Handler) http.Handler

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

func Root(r *http.Request) string

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 SessionGetValue

func SessionGetValue(r *http.Request, key string) (value int64, ok bool)

func SessionRedirect

func SessionRedirect(next http.Handler) http.Handler

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

func SessionSetValue(w http.ResponseWriter, r *http.Request, key string, value int64)

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL