auth

package
v0.1.23 Latest Latest
Warning

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

Go to latest
Published: Apr 4, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUserNameOrPassword = errors.New("用户名或密码错误")
)

Functions

func GetAccessToken

func GetAccessToken(req *LoginRequest) (string, uint, error)

GetAccessToken 登录

func Login

func Login(ctx iris.Context)

Login 登录 - LoginRequest 登录需要提交 uesrname 和 password 字段到接口 - validate.ValidRequest 验证接口提交参数,需要在 LoginRequest 的字段设置 validate:"required" - GetAccessToken 生成验证 token

func Party

func Party() func(public iris.Party)

Party 认证模块

Types

type LoginRequest

type LoginRequest struct {
	Username string `json:"username" validate:"required"`
	Password string `json:"password" validate:"required"`
}

LoginRequest 登录请求字段

func (*LoginRequest) Request

func (req *LoginRequest) Request(ctx iris.Context) error

Jump to

Keyboard shortcuts

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