Documentation ¶
Index ¶
- type SessionController
- func (sc *SessionController) AddSession(w http.ResponseWriter, un string)
- func (sc *SessionController) CheckSession(req *http.Request) (models.Session, bool)
- func (sc *SessionController) CleanExpiredSessions()
- func (sc *SessionController) DeleteSession(w http.ResponseWriter, req *http.Request) error
- func (sc *SessionController) ShowSessions()
- func (sc *SessionController) UpdateSession(w http.ResponseWriter, req *http.Request) error
- type UserController
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type SessionController ¶
type SessionController struct {
// contains filtered or unexported fields
}
SessionController for session's operation
func NewSessionController ¶
func NewSessionController(sessionLength int, database map[string]models.Session, cleanupTime time.Duration) *SessionController
NewSessionController creates a new instance
func (*SessionController) AddSession ¶
func (sc *SessionController) AddSession(w http.ResponseWriter, un string)
AddSession creates a session for a given user for the current request
func (*SessionController) CheckSession ¶
CheckSession returns true & session if there is any session and false if none
func (*SessionController) CleanExpiredSessions ¶
func (sc *SessionController) CleanExpiredSessions()
CleanExpiredSessions as the name suggests
func (*SessionController) DeleteSession ¶
func (sc *SessionController) DeleteSession(w http.ResponseWriter, req *http.Request) error
DeleteSession removes the current session
func (*SessionController) ShowSessions ¶
func (sc *SessionController) ShowSessions()
ShowSessions for demonstration purposes
func (*SessionController) UpdateSession ¶
func (sc *SessionController) UpdateSession(w http.ResponseWriter, req *http.Request) error
UpdateSession use the refresh the current request's session
type UserController ¶
type UserController struct {
// contains filtered or unexported fields
}
UserController for the User related data
func NewUserController ¶
func NewUserController(database map[string]models.User) *UserController
NewUserController creats a new UserController using the provided database
func (*UserController) GetUser ¶
func (uc *UserController) GetUser(un string) (models.User, bool)
GetUser returns the User data based on the supplied username `un`
func (*UserController) VerifyUser ¶
func (uc *UserController) VerifyUser(un string, pass string) bool
VerifyUser is basic User Authentication