login

package
v0.0.0-...-7f371a6 Latest Latest
Warning

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

Go to latest
Published: Mar 7, 2021 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Cookiename = "uid"
)

Variables

View Source
var ValidCookies = make(map[string]string)
View Source
var ValidUsers = map[string]User{
	"mike": {
		Salt:       "kfljdsfkj",
		Privileges: []Privilege{SudoPriv, MatekingPriv, LogPriv, MatekingManagerPriv},
	},
	"friend": {
		Salt:       "hello",
		Privileges: []Privilege{MatekingPriv},
	},
	"guest": {},
}

Functions

func CheckPriv

func CheckPriv(r *http.Request, priv Privilege) bool

func Decode

func Decode(in string) string

func Encode

func Encode(in string) string

func GetUser

func GetUser(r *http.Request) string

func Handler

func Handler(w http.ResponseWriter, r *http.Request)

Types

type Privilege

type Privilege int
const (
	MatekingPriv Privilege = iota
	LogPriv
	SudoPriv
	MatekingManagerPriv
)

type User

type User struct {
	Hash       string
	Salt       string
	Privileges []Privilege
}

func (*User) HasPrivilege

func (u *User) HasPrivilege(priv Privilege) bool

Jump to

Keyboard shortcuts

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