Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Jwt ¶
type Jwt struct {
// contains filtered or unexported fields
}
func NewDefaultJwt ¶
NewDefaultJwt returns an instance of jwt takes the signing method jwt.SigningMethodHS256
func NewJwtWithMethod ¶
func NewJwtWithMethod(storage Storage, secret []byte, duration time.Duration, method jwt.SigningMethod) *Jwt
NewJwtWithMethod returns an instance of jwt takes the given signing method
func (*Jwt) Invalidate ¶
Invalidate make the given tokenString invalid
type Storage ¶
type Storage interface { // Check a key if it is exist and return its remaining time to live TTL(key string) (duration time.Duration, err error) // Set key to hold a string value and to timeout after a given time.Duration SetEx(key, val string, duration time.Duration) error // Extend a key's living time duration before timeout ExtendKey(key string, duration time.Duration) error // Delete a key DelKey(key string) error }
Storage is an interface which will be used as an arg in Jwt.
func NewStorageRedis ¶
type StorageRedis ¶
type StorageRedis struct {
// contains filtered or unexported fields
}
func (StorageRedis) DelKey ¶
func (r StorageRedis) DelKey(key string) error
func (StorageRedis) ExtendKey ¶
func (r StorageRedis) ExtendKey(key string, duration time.Duration) error
Click to show internal directories.
Click to hide internal directories.