auth

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckPermissions

func CheckPermissions(user User, ctx *fasthttp.RequestCtx) bool

func ComparePassword

func ComparePassword(comPwd []byte, pwdHash string) bool

func DelCookie

func DelCookie(ctx *fasthttp.RequestCtx) bool

func EncodePassword

func EncodePassword(pwd []byte) string

func GenerateSessionId

func GenerateSessionId() string

func GetPermissions

func GetPermissions(role_id interface{}) []map[string]interface{}

func InMethodArr

func InMethodArr(arr []string, str string) bool

func SetCookie

func SetCookie(ctx *fasthttp.RequestCtx, user User) bool

Types

type Permission

type Permission struct {
	Method []string
	Path   []string
}

type SessionHelper

type SessionHelper struct {
	Sess sessions.Session
}

func InitSessionHelper

func InitSessionHelper(ctx *fasthttp.RequestCtx) *SessionHelper

func (*SessionHelper) GetUserIdFromSession

func (helper *SessionHelper) GetUserIdFromSession(cookieSec string) (id string)

func (*SessionHelper) PutIntoSession

func (helper *SessionHelper) PutIntoSession(value string) string

type User

type User struct {
	ID          string
	Level       string
	Name        string
	LevelName   string
	CreateAt    string
	Avatar      string
	Permissions []Permission
}

func Check

func Check(password []byte, username string) (user User, ok bool)

func Filter

func Filter(ctx *fasthttp.RequestCtx) (User, bool, bool)

func GetCurUserById

func GetCurUserById(id string) (user User, ok bool)

Jump to

Keyboard shortcuts

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