index

package
v0.0.29 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2023 License: BSD-3-Clause Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var MsgAuthenticationExpired = "authentication has expired, please log in again"
View Source
var Provides = wire.NewSet(
	wire.Struct(new(Controller), "*"),
	wire.Struct(new(Service), "*"),
)

Functions

This section is empty.

Types

type Controller

type Controller struct {
	IndexService *Service
	Csrf         *csrf.Csrf
	Values       *common.Values
}

func (*Controller) GetRefreshCode

func (x *Controller) GetRefreshCode(ctx context.Context, c *app.RequestContext)

GetRefreshCode @router /code [GET]

func (*Controller) GetUser

func (x *Controller) GetUser(ctx context.Context, c *app.RequestContext)

GetUser @router /user [GET]

func (*Controller) Login added in v0.0.29

func (x *Controller) Login(ctx context.Context, c *app.RequestContext)

Login @router /login [POST]

func (*Controller) Logout added in v0.0.29

func (x *Controller) Logout(ctx context.Context, c *app.RequestContext)

Logout @router /logout [POST]

func (*Controller) Options added in v0.0.29

func (x *Controller) Options(ctx context.Context, c *app.RequestContext)

Options 返回通用配置

func (*Controller) Ping added in v0.0.29

func (x *Controller) Ping(ctx context.Context, c *app.RequestContext)

Ping @router / [GET]

func (*Controller) RefreshToken added in v0.0.29

func (x *Controller) RefreshToken(ctx context.Context, c *app.RequestContext)

RefreshToken @router /refresh_token [POST]

func (*Controller) SetUser

func (x *Controller) SetUser(ctx context.Context, c *app.RequestContext)

SetUser @router /user [POST]

func (*Controller) UnsetUser

func (x *Controller) UnsetUser(ctx context.Context, c *app.RequestContext)

func (*Controller) Verify added in v0.0.29

func (x *Controller) Verify(ctx context.Context, c *app.RequestContext)

Verify @router /verify [GET]

type LoginDto added in v0.0.29

type LoginDto struct {
	Email    string `json:"email,required" vd:"email($)"`
	Password string `json:"password,required" vd:"len($)>=8"`
}

type OptionsDto added in v0.0.29

type OptionsDto struct {
	Type string `query:"type"`
}

type RefreshTokenDto added in v0.0.29

type RefreshTokenDto struct {
	Code string `json:"code,required"`
}

type Service

type Service struct {
	*common.Inject
	Passport        *passport.Passport
	Locker          *locker.Locker
	Captcha         *captcha.Captcha
	SessionsService *sessions.Service
	OpenAPIService  *openapi.Service
}

func (*Service) GetRefreshCode

func (x *Service) GetRefreshCode(ctx context.Context, userId string) (code string, err error)

func (*Service) GetUser

func (x *Service) GetUser(ctx context.Context, userId string) (data utils.H, err error)

func (*Service) Login

func (x *Service) Login(ctx context.Context, email string, password string, metadata *model.LoginMetadata) (ts string, err error)

func (*Service) Logout added in v0.0.29

func (x *Service) Logout(ctx context.Context, userId string) (err error)

func (*Service) RefreshToken added in v0.0.29

func (x *Service) RefreshToken(ctx context.Context, claims passport.Claims, code string) (ts string, err error)

func (*Service) SetUser

func (x *Service) SetUser(ctx context.Context, userId string, update bson.M) (result interface{}, err error)

func (*Service) Verify added in v0.0.29

func (x *Service) Verify(ctx context.Context, ts string) (claims passport.Claims, err error)

func (*Service) WriteLoginLog added in v0.0.29

func (x *Service) WriteLoginLog(ctx context.Context, metadata model.LoginMetadata, data model.LoginData) (err error)

type SetUserDto added in v0.0.29

type SetUserDto struct {
	Set         string `json:"$set,required" vd:"in($, 'email', 'name', 'avatar', 'password', 'backup_email')"`
	Email       string `json:"email,omitempty" vd:"(Set)$!='Email' || email($);msg:'must be email'"`
	BackupEmail string `json:"backup_email,omitempty" vd:"(Set)$!='BackupEmail' || email($);msg:'must be email'"`
	Name        string `json:"name,omitempty"`
	Avatar      string `json:"avatar,omitempty"`
	Password    string `json:"password,omitempty" vd:"(Set)$!='Password' || len($)>8;msg:'must be greater than 8 characters'"`
}

type UnsetUserDto added in v0.0.29

type UnsetUserDto struct {
	Key string `path:"key,required" vd:"in($, 'feishu')"`
}

Jump to

Keyboard shortcuts

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