Documentation
¶
Index ¶
- Variables
- type Address
- type AuthMongoDBCtx
- func (a *AuthMongoDBCtx) AddUser(email, password string, notif, app bool) error
- func (a *AuthMongoDBCtx) AddUserInfo(email, password string, info Info, pri map[string]bool, notif, app bool) error
- func (a *AuthMongoDBCtx) CountUserOnline() int
- func (a *AuthMongoDBCtx) DeleteUser(id string) error
- func (a *AuthMongoDBCtx) FindAllUser(offsetKey string, limit int) ([]*User, error)
- func (a *AuthMongoDBCtx) FindUser(id string) (*User, error)
- func (a *AuthMongoDBCtx) FindUserByEmail(email string) (*User, error)
- func (a *AuthMongoDBCtx) FindUserOnline(offsetKey string, limit int) ([]*User, error)
- func (a *AuthMongoDBCtx) GetUser() (*User, error)
- func (a *AuthMongoDBCtx) LogginUser(id string, remember int) error
- func (a *AuthMongoDBCtx) SetDomain(d string)
- func (a *AuthMongoDBCtx) SetFormatChecker(c FormatChecker)
- func (a *AuthMongoDBCtx) SetHashFunc(h hash.Hash)
- func (a *AuthMongoDBCtx) SetNotificater(n Notificater)
- func (a *AuthMongoDBCtx) SetOnlineThreshold(t int)
- func (a *AuthMongoDBCtx) SetPath(p string)
- func (a *AuthMongoDBCtx) ValidateUser(email string, password string) (*User, error)
- type Authenticater
- type Config
- type FormatChecker
- type Info
- type Notificater
- type Password
- type SimpleChecker
- type SimpleNotificater
- type User
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type AuthMongoDBCtx ¶
type AuthMongoDBCtx struct {
// contains filtered or unexported fields
}
func NewAuthDBCtx ¶
func NewAuthDBCtx(w http.ResponseWriter, r *http.Request, sess sessions.Provider, userColl, rememberColl *mgo.Collection) *AuthMongoDBCtx
func (*AuthMongoDBCtx) AddUser ¶
func (a *AuthMongoDBCtx) AddUser(email, password string, notif, app bool) error
func (*AuthMongoDBCtx) AddUserInfo ¶
func (*AuthMongoDBCtx) CountUserOnline ¶
func (a *AuthMongoDBCtx) CountUserOnline() int
func (*AuthMongoDBCtx) DeleteUser ¶
func (a *AuthMongoDBCtx) DeleteUser(id string) error
func (*AuthMongoDBCtx) FindAllUser ¶
func (a *AuthMongoDBCtx) FindAllUser(offsetKey string, limit int) ([]*User, error)
func (*AuthMongoDBCtx) FindUserByEmail ¶
func (a *AuthMongoDBCtx) FindUserByEmail(email string) (*User, error)
func (*AuthMongoDBCtx) FindUserOnline ¶
func (a *AuthMongoDBCtx) FindUserOnline(offsetKey string, limit int) ([]*User, error)
func (*AuthMongoDBCtx) GetUser ¶
func (a *AuthMongoDBCtx) GetUser() (*User, error)
func (*AuthMongoDBCtx) LogginUser ¶
func (a *AuthMongoDBCtx) LogginUser(id string, remember int) error
func (*AuthMongoDBCtx) SetDomain ¶
func (a *AuthMongoDBCtx) SetDomain(d string)
func (*AuthMongoDBCtx) SetFormatChecker ¶
func (a *AuthMongoDBCtx) SetFormatChecker(c FormatChecker)
func (*AuthMongoDBCtx) SetHashFunc ¶
func (a *AuthMongoDBCtx) SetHashFunc(h hash.Hash)
func (*AuthMongoDBCtx) SetNotificater ¶
func (a *AuthMongoDBCtx) SetNotificater(n Notificater)
func (*AuthMongoDBCtx) SetOnlineThreshold ¶
func (a *AuthMongoDBCtx) SetOnlineThreshold(t int)
func (*AuthMongoDBCtx) SetPath ¶
func (a *AuthMongoDBCtx) SetPath(p string)
func (*AuthMongoDBCtx) ValidateUser ¶
func (a *AuthMongoDBCtx) ValidateUser(email string, password string) (*User, error)
type Authenticater ¶
type Authenticater interface { SetPath(p string) SetDomain(d string) // SetOnlineThreshold sets the online threshold time, if t <= 0, the loggin // state will last until the session expired. SetOnlineThreshold(t int) // SetHashFunc sets the hash.Hash which will be use for password hasing SetHashFunc(h hash.Hash) // SetNotificater sets the Notificater which will be use for sending // notification to user when account added or password changed. SetNotificater(n Notificater) // SetFormatChecker sets a FormatChecker for validate email/password SetFormatChecker(c FormatChecker) // AddUser adds an user to database with email and password; // if notif is true, a NewAccount notification will be send to user by the // Notificater. If app is false, the user is waiting to be approved. // It returns an error describes the first issue encountered, if any. AddUser(email, pwd string, notif, app bool) error // AddUserInfo adds an user to database; // if notif is true, a NewAccount notification will be send to user by the // Notificater. If app is false, the user is waiting to be approved. // It returns an error describes the first issue encountered, if any. AddUserInfo(email, pwd string, info Info, pri map[string]bool, notif, app bool) error // DeleteUserByEmail deletes an user from database base on the given id; // It returns an error describes the first issue encountered, if any. DeleteUser(id string) error // GetUser gets the infomations and update the LastActivity of the current // logged user; // It returns an error describes the first issue encountered, if any. GetUser() (*User, error) // FindUser finds the user with the given id; // Its returns an ErrNotFound if the user's id was not found. FindUser(id string) (*User, error) // FindUserByEmail like FindUser but receive an email FindUserByEmail(email string) (*User, error) // FindAllUser finds and return a slice of user. // offsetId, limit define which sub-sequence of matching users to return. // Limit take an number of user per page; offsetId take the Id of the last // user of the previous page. FindAllUser(offsetId string, limit int) ([]*User, error) // FindAllUserOline finds and return a slice of current logged user. // See FindAllUser for the usage. FindUserOnline(offsetId string, limit int) ([]*User, error) // CountUserOnline counts the number of user current logged. // It counts the user that LastActivity+OnlineThreshold<Now. CountUserOnline() int // ValidateUser validate user email and password. // It returns the user infomations if the email and password is correct. ValidateUser(email string, password string) (*User, error) // LogginUser logs user in by using a session that store user id string. // Remember take a number of second to keep the user loggin state. // Developer must call LogginUser before send any output to browser. LogginUser(id string, remember int) error }
type FormatChecker ¶
type Notificater ¶
type SimpleChecker ¶
type SimpleChecker struct {
// contains filtered or unexported fields
}
func NewSimpleChecker ¶
func NewSimpleChecker(pwdlen int) (*SimpleChecker, error)
func (*SimpleChecker) EmailValidate ¶
func (c *SimpleChecker) EmailValidate(email string) bool
func (*SimpleChecker) PasswordValidate ¶
func (c *SimpleChecker) PasswordValidate(pwd string) bool
type SimpleNotificater ¶
type SimpleNotificater struct{}
func NewSimpleNotificater ¶
func NewSimpleNotificater() *SimpleNotificater
func (*SimpleNotificater) AccountAdded ¶
func (n *SimpleNotificater) AccountAdded(email string, app bool) error
func (*SimpleNotificater) PasswordChanged ¶
func (n *SimpleNotificater) PasswordChanged(email string) error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.