auth

package
v0.0.0-...-1bd4bba Latest Latest
Warning

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

Go to latest
Published: Apr 14, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LoginSuccess  = "登录成功!"
	LoginFail     = "登录失败!"
	LogoutSuccess = "注销成功!"
	LogoutFail    = "注销失败!"

	ErrorUsernameOrPassword = "用户名或密码错误!"
	ErrorDisableStatus      = "账户锁定, 请联系管理员"
	ErrorAccessExpiredTime  = "签名过期, 请重新登陆"
	ErrorCheckExpiredTime   = "签名错误, 检查token是否正确"
	ErrorRefreshExpiredTime = "刷新签名过期, 请重新登陆"
)

Variables

This section is empty.

Functions

func InitRoutes

func InitRoutes(route fiber.Router)

Types

type Handler

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

func NewHandler

func NewHandler() *Handler

func (*Handler) Login

func (h *Handler) Login(c *fiber.Ctx) error

func (*Handler) QueryInfo

func (h *Handler) QueryInfo(c *fiber.Ctx) error

func (*Handler) Refresh

func (h *Handler) Refresh(c *fiber.Ctx) error

func (*Handler) Test

func (h *Handler) Test(c *fiber.Ctx) error

type InfoOutput

type InfoOutput struct {
	Staff       *staff.Staff       `json:"staff"`
	Menus       []*menu.MenuOutput `json:"menus"`
	Permissions []string           `json:"permissions"`
}

type LoginInput

type LoginInput struct {
	Username string `zh:"用户名称" json:"username" validate:"required"`
	Password string `zh:"用户密码" json:"password" validate:"required"`
}

type LoginOutput

type LoginOutput struct {
	ID       string `json:"id"`
	Username string `json:"username"`
	Avatar   string `json:"avatar"`
	Access   string `json:"access"`
	Refresh  string `json:"refresh"`
}

type RefreshInput

type RefreshInput struct {
	Refresh string `json:"refresh" validate:"required"`
}

type Service

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

func NewService

func NewService() *Service

func (*Service) Login

func (s *Service) Login(req *LoginInput) (*staff.Staff, error)

func (*Service) Logout

func (s *Service) Logout(id string) error

func (*Service) QueryInfo

func (s *Service) QueryInfo(id string) (*InfoOutput, error)

func (*Service) Refresh

func (s *Service) Refresh(id string) (*staff.Staff, error)

Jump to

Keyboard shortcuts

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