Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type Token ¶
type TokenManager ¶
type TokenManager struct {
// contains filtered or unexported fields
}
func NewTokenManager ¶
func NewTokenManager(redisConn *redis.Redis, ttl time.Duration) *TokenManager
func (*TokenManager) Authenticate ¶
func (tm *TokenManager) Authenticate(t *Token) error
Authenticate checks if token is valid for the given account
func (*TokenManager) Create ¶
func (tm *TokenManager) Create(id string) (*Token, error)
Create creates a token with a random uuid and TTL. It is not idempotent, therefore with every call, it regenerates the token for id
func (*TokenManager) GetOrCreate ¶
func (tm *TokenManager) GetOrCreate(id string) (*Token, error)
GetOrCreate gets token of the given account, and creates if it does not exist
func (*TokenManager) Invalidate ¶
func (tm *TokenManager) Invalidate(id string) error
Click to show internal directories.
Click to hide internal directories.