auth

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2018 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service manages authentification.

func NewService

func NewService(db *database.Database, sessionStore sessions.Store) *Service

NewService returns a new suthentification service

func (*Service) GetUser

func (service *Service) GetUser(r *http.Request) (*models.User, error)

GetUser retrieves the user associated with a request

func (*Service) Login

func (service *Service) Login(r *http.Request, w http.ResponseWriter, id uint, username string) error

Login finds or creates a user and associates it with the request

func (*Service) Logout

func (service *Service) Logout(r *http.Request, w http.ResponseWriter)

Logout logs out the user

func (*Service) SetUser

func (service *Service) SetUser(r *http.Request, w http.ResponseWriter, user *models.User)

SetUser associates a user with a request

Jump to

Keyboard shortcuts

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