Documentation ¶
Index ¶
- Constants
- type Default
- func (d *Default) Delete(k string)
- func (d *Default) DeleteSession(id string)
- func (d *Default) Get(k string) (interface{}, bool)
- func (d *Default) GetSession(k string) (GSession, bool)
- func (d *Default) Set(k string, v interface{}, timeout time.Duration)
- func (d *Default) SetSession(k string, session GSession, timeout time.Duration)
- func (d *Default) Update(k string, v interface{}, timeout time.Duration)
- func (d *Default) UpdateSession(session GSession, timeout time.Duration)
- type DefaultPermissionHolder
- type GLogic
- func (logic *GLogic) CreateLoginSession(id interface{}) string
- func (logic *GLogic) CreateLoginSessionWithModel(id interface{}, model LoginModel) string
- func (logic *GLogic) GetLoginId(token string) (interface{}, error)
- func (logic *GLogic) RemoveTokenById(id interface{}, device string)
- func (logic *GLogic) RenewTimeout(id interface{}, token string)
- type GSession
- type GTokenError
- type LoginModel
- type PermissionHolder
- type TokenSign
- type TokenStorage
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) DeleteSession ¶
func (*Default) SetSession ¶
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 (*GLogic) CreateLoginSessionWithModel ¶
func (logic *GLogic) CreateLoginSessionWithModel(id interface{}, model LoginModel) string
func (*GLogic) GetLoginId ¶
func (*GLogic) RemoveTokenById ¶
func (*GLogic) RenewTimeout ¶
type GSession ¶
type GSession struct { Id string CreatedTime time.Time Data map[string]interface{} TokenSigns []TokenSign }
func (*GSession) RemoveSign ¶
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 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) }
Click to show internal directories.
Click to hide internal directories.