Versions in this module Expand all Collapse all v0 v0.0.5 Sep 5, 2024 v0.0.4 Sep 5, 2024 Changes in this version + var PlatformError = apiError(40003, "平台名称错误") + func GetRedisName() string + func InitAuthRule() + func ReInitAuthRule() + func SetGetPlatformFunc(f func(ctx context.Context) string) + func SetSignTokenFunc(f func(ctx context.Context, s *SimpleTokenContent) (string, error)) + func SetUnSignTokenFunc(f func(ctx context.Context, content string) (*SimpleTokenContent, error)) v0.0.3 Sep 5, 2024 v0.0.2 Sep 5, 2024 Changes in this version type SimpleTokenContent + func UnpackSimpleJwt(content string) (*SimpleTokenContent, error) v0.0.1 Sep 5, 2024 Changes in this version + const AND + const CacheModeMemory + const CacheModeNone + const CacheModeRedis + const CachePrefixUserPermission + const CachePrefixUserToken + const CachePrefixUserTokenArray + const CtxUserId + const EXCLUDE + const OR + var IllegalPermissionError = apiError(40000, "非法权限") + var IllegalTokensError = apiError(40001, "非法token") + var UrlPrefixError = apiError(40002, "路由前缀错误") + func ClearUserTokenInMemory(ctx context.Context, userId int64) error + func ClearUserTokenInRedis(ctx context.Context, userId int64) error + func GenerateToken(ctx context.Context, userId int64) (string, error) + func GenerateTokenToMemory(ctx context.Context, userId int64) (string, error) + func GenerateTokenToRedis(ctx context.Context, userId int64) (string, error) + func GetCacheExpireDt() int64 + func GetCacheExpireDtDuration() time.Duration + func GetCacheMode() string + func GetIssuer() string + func Login(ctx context.Context, userId int64) (string, error) + func Logout(ctx context.Context, userId int64) (string, error) + func ReInitRule() + func RequiredAuth(r *ghttp.Request) + func SetGetGroupCodesFunc(f func(ctx context.Context, userId int64) ([]string, error)) + func SetGetPermissionCodes(f func(ctx context.Context, userId int64) ([]string, error)) + type CurrentUser struct + UserId int64 + type DefaultHandlerResponse struct + Code int + Data interface{} + Message string + Platform string + type Rule struct + Path string + Permission []RulePermission + type RuleConfig struct + CacheMode string + ExpireDt int64 + Issuer string + RedisName string + Rule []Rule + type RulePermission struct + Code []string + CodeMode string + Group []string + GroupMode string + func GetRule(path string) []RulePermission + type SimpleTokenContent struct + ExpireDt int64 + IssuedDt time.Time + Issuer string + UserId int64 + func NewSimpleTokenContent(userId int64) *SimpleTokenContent + func (j *SimpleTokenContent) IsValidate() bool