core

package
v0.0.0-...-83d1294 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultDevice string = "default-device"

Variables

This section is empty.

Functions

This section is empty.

Types

type Default

type Default struct {
	Cache *cache.Cache
}

func (*Default) Delete

func (d *Default) Delete(k string)

func (*Default) DeleteSession

func (d *Default) DeleteSession(id string)

func (*Default) Get

func (d *Default) Get(k string) (interface{}, bool)

func (*Default) GetSession

func (d *Default) GetSession(k string) (GSession, bool)

func (*Default) Set

func (d *Default) Set(k string, v interface{}, timeout time.Duration)

func (*Default) SetSession

func (d *Default) SetSession(k string, session GSession, timeout time.Duration)

func (*Default) Update

func (d *Default) Update(k string, v interface{}, timeout time.Duration)

func (*Default) UpdateSession

func (d *Default) UpdateSession(session GSession, timeout time.Duration)

type DefaultPermissionHolder

type DefaultPermissionHolder struct {
}

func (DefaultPermissionHolder) Permissions

func (d DefaultPermissionHolder) Permissions(id interface{}) []string

func (DefaultPermissionHolder) Roles

func (d DefaultPermissionHolder) Roles(id interface{}) []string

type GLogic

type GLogic struct {
	LoginType string //多账号体系 user admin login
	TokenCfg  *ginToken.TokenConfig
	CookieCfg *ginToken.CookieConfig
	Storage   TokenStorage
}

func (*GLogic) CreateLoginSession

func (logic *GLogic) CreateLoginSession(id interface{}) string

func (*GLogic) CreateLoginSessionWithModel

func (logic *GLogic) CreateLoginSessionWithModel(id interface{}, model LoginModel) string

func (*GLogic) GetLoginId

func (logic *GLogic) GetLoginId(token string) (interface{}, error)

func (*GLogic) RemoveTokenById

func (logic *GLogic) RemoveTokenById(id interface{}, device string)

func (*GLogic) RenewTimeout

func (logic *GLogic) RenewTimeout(id interface{}, token string)

type GSession

type GSession struct {
	Id          string
	CreatedTime time.Time
	Data        map[string]interface{}
	TokenSigns  []TokenSign
}

func (*GSession) RemoveSign

func (s *GSession) RemoveSign(token string)

type GTokenError

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

func Errorf

func Errorf(f string, v ...any) GTokenError

func (GTokenError) Error

func (e GTokenError) Error() string

type LoginModel

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

func (*LoginModel) Build

func (m *LoginModel) Build(config gintoken.Config)

type PermissionHolder

type PermissionHolder interface {
	Permissions(id interface{}) []string
	Roles(id interface{}) []string
}

PermissionHolder implement PermissionHolder to get user permissions and roles

type TokenSign

type TokenSign struct {
	Device string
	Token  string
}

type TokenStorage

type TokenStorage interface {
	Set(k string, v interface{}, timeout time.Duration)
	Get(k string) (interface{}, bool)
	Delete(k string)
	Update(k string, v interface{}, timeout time.Duration)
	SetSession(k string, session GSession, timeout time.Duration)
	GetSession(k string) (GSession, bool)
	UpdateSession(session GSession, timeout time.Duration)
	DeleteSession(k string)
}

Jump to

Keyboard shortcuts

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