Versions in this module Expand all Collapse all v1 v1.2.12 May 22, 2020 Changes in this version + const DefaultCookieKey + const ServiceKey + const TokenServiceKey + func Auth(ctx *context.Context) models.UserModel + func Check(password string, username string, conn db.Connection) (user models.UserModel, ok bool) + func CheckPermissions(user models.UserModel, path, method string, param url.Values) bool + func DelCookie(ctx *context.Context, conn db.Connection) error + func EncodePassword(pwd []byte) string + func Filter(ctx *context.Context, conn db.Connection) (models.UserModel, bool, bool) + func GetCurUser(sesKey string, conn db.Connection) (user models.UserModel, ok bool) + func GetCurUserByID(id int64, conn db.Connection) (user models.UserModel, ok bool) + func GetSessionByKey(sesKey, key string, conn db.Connection) (interface{}, error) + func GetUserID(sesKey string, conn db.Connection) int64 + func Middleware(conn db.Connection) context.Handler + func SetCookie(ctx *context.Context, user models.UserModel, conn db.Connection) error + type CSRFToken []string + type Config struct + Cookie string + Expires time.Duration + type DBDriver struct + func (driver *DBDriver) Load(sid string) (map[string]interface{}, error) + func (driver *DBDriver) Update(sid string, values map[string]interface{}) error + type Invoker struct + func DefaultInvoker(conn db.Connection) *Invoker + func SetPrefix(prefix string, conn db.Connection) *Invoker + func (invoker *Invoker) Middleware() context.Handler + func (invoker *Invoker) SetAuthFailCallback(callback MiddlewareCallback) *Invoker + func (invoker *Invoker) SetPermissionDenyCallback(callback MiddlewareCallback) *Invoker + type MiddlewareCallback func(ctx *context.Context) + type PersistenceDriver interface + Load func(string) (map[string]interface{}, error) + Update func(sid string, values map[string]interface{}) error + type Processor func(ctx *context.Context) (model models.UserModel, exist bool, msg string) + type Service struct + P Processor + func GetService(s interface{}) *Service + func NewService(processor Processor) *Service + func (s *Service) Name() string + type Session struct + Context *context.Context + Cookie string + Driver PersistenceDriver + Expires time.Duration + Sid string + Values map[string]interface{} + func InitSession(ctx *context.Context, conn db.Connection) (*Session, error) + func (ses *Session) Add(key string, value interface{}) error + func (ses *Session) Clear() error + func (ses *Session) Get(key string) interface{} + func (ses *Session) StartCtx(ctx *context.Context) (*Session, error) + func (ses *Session) UpdateConfig(config Config) + func (ses *Session) UseDriver(driver PersistenceDriver) + type TokenService struct + func GetTokenService(s interface{}) *TokenService + func (s *TokenService) AddToken() string + func (s *TokenService) CheckToken(toCheckToken string) bool + func (s *TokenService) Name() string