session

package
v0.0.0-...-0c294a2 Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2022 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Name = "session"
)

Variables

View Source
var (
	// Store contains all sessions
	Store *sessions.FilesystemStore

	StorageDir string

	Log = logrus.New()
)

Functions

func Destroy

func Destroy(w http.ResponseWriter, r *http.Request) (err error)

Destroy a session

func GetNumSessions

func GetNumSessions() int

func GetSession

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

func GetSessionID

func GetSessionID(r *http.Request) string

func GetUserID

func GetUserID(w http.ResponseWriter, r *http.Request) string

GetUserID returns the corresponding userID for a request

func GetUserIDInt

func GetUserIDInt(w http.ResponseWriter, r *http.Request) (int, error)

GetUserIDInt returns the corresponding userID for a request

func InitStore

func InitStore(secret string, dbHandle bleve.Index, maxAge int)

InitStore initializes the session store secret should be generated using securecookie.GenerateRandomKey() maxAge is supplied in seconds pass maxAge=0 for no timeout

func SetUserID

func SetUserID(w http.ResponseWriter, r *http.Request, userID string) (string, error)

SetUserID sets the userID as a cookie on the response and persists it in the Store

Types

This section is empty.

Jump to

Keyboard shortcuts

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