Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrUnexpectedSigningMethod = errors.New("unexpected signing method") ErrInvalidToken = errors.New("invalid token") ErrSessionExpired = errors.New("session expired") ErrInternalServer = errors.New("internal server error") ErrRefreshExpired = errors.New("refresh token expired due to logout / password change") ErrUnknownTokenType = errors.New("unknown token type") ErrInBlackList = errors.New("refresh token revoked or not found") )
Functions ¶
func NewRedisStorage ¶
func NewRedisStorage(client *redis.Client) (*RedisBlackList, *RedisVersioner)
Types ¶
type BlackListStorage ¶
type JWT ¶
type JWT struct {
// contains filtered or unexported fields
}
func NewJWT ¶
func NewJWT(jwtService *JWTService, accessTTL, refreshTTL time.Duration, signingKey string) *JWT
func (*JWT) GenerateToken ¶
type JWTInterface ¶
type JWTService ¶
type JWTService struct {
// contains filtered or unexported fields
}
func NewJWTService ¶
func NewJWTService(bl BlackListStorage, tv TokenVersionStorage) *JWTService
type RedisBlackList ¶
type RedisBlackList struct {
// contains filtered or unexported fields
}
func (*RedisBlackList) AddToBlackList ¶
func (r *RedisBlackList) AddToBlackList(token string, ttl time.Duration) error
func (*RedisBlackList) IsBlackListed ¶
func (r *RedisBlackList) IsBlackListed(token string) bool
type RedisVersioner ¶
type RedisVersioner struct {
// contains filtered or unexported fields
}
func (*RedisVersioner) GetVersion ¶
func (r *RedisVersioner) GetVersion(userID uint) (uint, error)
func (*RedisVersioner) IncrementVersion ¶
func (r *RedisVersioner) IncrementVersion(userID uint) error
type TokenVersionStorage ¶
Click to show internal directories.
Click to hide internal directories.