Documentation ¶
Index ¶
- Constants
- Variables
- func Available(token string) bool
- func Destroy(token string, expired time.Duration) error
- func GenDefaultToken(claim DefaultClaims) (string, error)
- func NewRedisClient(c RedisConfig) *redis.Client
- func RandGenSalt() string
- func SetStore(store Store)
- type DefaultClaims
- type EmixConfig
- type MemoryStore
- type Operation
- type RedisConfig
- type RedisStore
- type RootConfig
- type Store
- type TokenConfig
Constants ¶
View Source
const SaltSource string = "adcdefghjkmnpqrstuvwxyz1234567890ABCDEFGHJKLMNPQRSTUVWXYZ9876543210"
Variables ¶
View Source
var SignKey = ""
View Source
var TokenExpiredErr = errors.New("token expired")
View Source
var TokenInvalidErr = errors.New("token invalid")
View Source
var TokenMalformedErr = errors.New("token malformed error")
View Source
var TokenNotAvailableErr = errors.New("token not available")
View Source
var TokenNotValidYetErr = errors.New("token not valid yet")
Functions ¶
func GenDefaultToken ¶
func GenDefaultToken(claim DefaultClaims) (string, error)
func NewRedisClient ¶
func NewRedisClient(c RedisConfig) *redis.Client
func RandGenSalt ¶
func RandGenSalt() string
Types ¶
type DefaultClaims ¶
type DefaultClaims struct { jwt.StandardClaims Id int Nickname string Phone string Name string Salt string }
func ParseDefaultToken ¶
func ParseDefaultToken(token string) (*DefaultClaims, error)
type EmixConfig ¶
type EmixConfig struct {
Token TokenConfig `yaml:"token"`
}
type MemoryStore ¶
type MemoryStore struct {
// contains filtered or unexported fields
}
func NewMemoryStore ¶
func NewMemoryStore() *MemoryStore
func (*MemoryStore) Available ¶
func (r *MemoryStore) Available(token string) bool
type Operation ¶
type Operation struct {
// contains filtered or unexported fields
}
func AfterInit ¶
func AfterInit(yamlFile string, rc ...RedisConfig) (oper Operation)
type RedisConfig ¶
type RedisStore ¶
type RedisStore struct { *redis.Client // contains filtered or unexported fields }
func NewRedisStore ¶
func NewRedisStore(config RedisConfig) *RedisStore
func (*RedisStore) Available ¶
func (r *RedisStore) Available(token string) bool
type RootConfig ¶
type RootConfig struct {
Emix EmixConfig `yaml:"emix"`
}
type TokenConfig ¶
type TokenConfig struct { Redis RedisConfig `yaml:"redis"` SignKey string `yaml:"signKey"` }
Click to show internal directories.
Click to hide internal directories.