Documentation
¶
Index ¶
Constants ¶
View Source
const ( Memory = iota Redis )
View Source
const (
Jwt = iota
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CustomClaims ¶
type CustomClaims struct {
UserId string
UserInfo map[string]interface{}
jwt.StandardClaims
}
type GeneratorType ¶
type GeneratorType int
type ManagerType ¶
type ManagerType int
type TokenGenerator ¶
type TokenManager ¶
type TokenManager interface {
Record(userToken string, userInfo map[string]interface{}) bool
GenerateAndRecord(userId string, userInfo map[string]interface{}, expireAt int64) (tokens string, err *errors.Error)
IsNotExpired(token string, allowSec int64) (*CustomClaims, int)
IsMeetRefresh(token string) bool
Refresh(oldToken, newToken string) bool
IsEffective(token string) bool
Destroy(token string)
GetUserID(token string) (userID string, exisit bool)
CleanAll()
Clean(userId string)
}
type TokenService ¶
type TokenService struct {
Generator TokenGenerator
Manager TokenManager
}
func Get ¶
func Get(generatorType GeneratorType, managerType ManagerType) *TokenService
func GetDef ¶
func GetDef() *TokenService
Click to show internal directories.
Click to hide internal directories.