Documentation ¶
Index ¶
- func GenerateId() string
- func NewMongoDb(path string) *mongoDBContext
- func NewSession() *sessionMemoryMW
- func NewSessionId() *sessionIdContext
- func NewSessionMongoDB() *sessionMongoDBMW
- func NewUserCustomStoreMW(storefactory func(*webapp.Context) UserStore) *userMW
- func NewUserMW() *userMW
- type BasicSession
- type DefaultUserStore
- type M
- type SessionMongoDB
- type Static
- type UserStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateId ¶
func GenerateId() string
func NewMongoDb ¶
func NewMongoDb(path string) *mongoDBContext
func NewSession ¶
func NewSession() *sessionMemoryMW
func NewSessionId ¶
func NewSessionId() *sessionIdContext
NewSessionId Creates a SessionId and keeps track of the session using cookies This Middleware only manages a sessionid and does manage session data.
func NewSessionMongoDB ¶
func NewSessionMongoDB() *sessionMongoDBMW
func NewUserCustomStoreMW ¶
NewUserCustomStoreMW Allows a custom store constructor. The storefactory method must return a struct of type UserStore Interface
Types ¶
type BasicSession ¶
type BasicSession struct {
// contains filtered or unexported fields
}
BasicSession is a basic session store that stores session data in local memory
func (*BasicSession) Get ¶
func (this *BasicSession) Get(name string) interface{}
Get get a session variable
func (*BasicSession) GetAll ¶
func (this *BasicSession) GetAll() map[string]interface{}
GetAll Get all session variables.
func (*BasicSession) SessionId ¶
func (this *BasicSession) SessionId() string
SessionId return the sessionid associated with this session.
func (*BasicSession) Set ¶
func (this *BasicSession) Set(name string, value interface{}) webapp.Session
Set a session variable if value is nil, the key will be removed from the Session.
func (*BasicSession) SetSessionId ¶
func (this *BasicSession) SetSessionId(id string)
type DefaultUserStore ¶
type DefaultUserStore struct {
// contains filtered or unexported fields
}
func (*DefaultUserStore) Authenticate ¶
func (this *DefaultUserStore) Authenticate(username, password string) bool
func (*DefaultUserStore) GetUser ¶
func (this *DefaultUserStore) GetUser(username string) *webapp.User
func (*DefaultUserStore) VerifyUser ¶
func (this *DefaultUserStore) VerifyUser(username string) bool
type SessionMongoDB ¶
type SessionMongoDB struct {
// contains filtered or unexported fields
}
SessionMongoDB store session data in mangodb
func (*SessionMongoDB) Get ¶
func (this *SessionMongoDB) Get(name string) interface{}
Get get a session variable
func (*SessionMongoDB) GetAll ¶
func (this *SessionMongoDB) GetAll() map[string]interface{}
GetAll Get all session variables.
func (*SessionMongoDB) SessionId ¶
func (this *SessionMongoDB) SessionId() string
SessionId return the sessionid associated with this session.
func (*SessionMongoDB) Set ¶
func (this *SessionMongoDB) Set(name string, value interface{}) webapp.Session
Set a session variable if value is nil, the key will be removed from the Session.
func (*SessionMongoDB) SetSessionId ¶
func (this *SessionMongoDB) SetSessionId(id string)
type Static ¶
type Static struct { // Dir is the directory to serve static files from Dir http.FileSystem // Prefix is the optional prefix used to serve the static directory content Prefix string // IndexFile defines which file to serve as index if it exists. IndexFile string }
Static is a middleware handler that serves static files in the given directory/filesystem.
func NewStatic ¶
func NewStatic(directory http.FileSystem) *Static
NewStatic returns a new instance of Static