session

package
v0.0.0-...-00d6d83 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2016 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EXPIRED int = 1
	ACTIVE  int = 2
	DELETED int = 3
	//SIDLEN Length of each SessionID. Change this value to change the length of each Session ID created by uafm.
	SIDLEN int = 32
)

Variables

This section is empty.

Functions

func GenerateUniqueSid

func GenerateUniqueSid() string

GenerateUniqueSid is cryptographically safe enough with crypto/rand function.

func InitSMs

func InitSMs(usercollectionname, formcollectionname string)

Types

type Session

type Session struct {
	Sid     string    `bson:"sid"`
	Rid     string    `bson:"rid"`
	Expires time.Time `bson:"expires"`
	Status  int       `bson:"-"`
}

type SessionManager

type SessionManager struct {
	Collection *mgo.Collection
}
var FormSM *SessionManager
var UserSM *SessionManager

func (*SessionManager) Clean

func (sm *SessionManager) Clean()

func (*SessionManager) DeleteSession

func (sm *SessionManager) DeleteSession(sid string) (int, error)

func (*SessionManager) GetSession

func (sm *SessionManager) GetSession(sid string) (*Session, error)

func (*SessionManager) SetSession

func (sm *SessionManager) SetSession(rid string, life time.Duration) (*Session, error)

Jump to

Keyboard shortcuts

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