controller

package
v0.0.0-...-baf0b24 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2020 License: MIT Imports: 9 Imported by: 1

Documentation

Index

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

func (sc *SessionController) CheckSession(req *http.Request) (models.Session, bool)

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) AddUser

func (uc *UserController) AddUser(req *http.Request) (models.User, error)

AddUser to User 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

Jump to

Keyboard shortcuts

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