Documentation
¶
Index ¶
- type Logger
- func (l *Logger) GetTokenFromCache(token gojwttoken.Token, id int64)
- func (l *Logger) GetTokenFromCacheFailed(err error)
- func (l *Logger) RevokeTokenFromCache(token gojwttoken.Token, id int64)
- func (l *Logger) RevokeTokenFromCacheFailed(err error)
- func (l *Logger) SetTokenToCache(token gojwttoken.Token, id int64)
- func (l *Logger) SetTokenToCacheFailed(err error)
- type TokenValidator
- type TokenValidatorService
- func (t *TokenValidatorService) GetKey(token gojwttoken.Token, id string) (string, error)
- func (t *TokenValidatorService) IsValid(token gojwttoken.Token, id string) (bool, error)
- func (t *TokenValidatorService) Revoke(token gojwttoken.Token, id string) error
- func (t *TokenValidatorService) Set(token gojwttoken.Token, id string, isValid bool, expiresAt time.Time) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Logger ¶ added in v0.4.3
type Logger struct {
// contains filtered or unexported fields
}
Logger is the cache token validator logger
func NewLogger ¶ added in v0.4.3
func NewLogger(header string, modeLogger gologgermode.Logger) (*Logger, error)
NewLogger creates a new cache token validator logger
func (*Logger) GetTokenFromCache ¶ added in v0.4.3
func (l *Logger) GetTokenFromCache(token gojwttoken.Token, id int64)
GetTokenFromCache logs the get token from cache event
func (*Logger) GetTokenFromCacheFailed ¶ added in v0.4.3
GetTokenFromCacheFailed logs the get token from cache failed event
func (*Logger) RevokeTokenFromCache ¶ added in v0.4.7
func (l *Logger) RevokeTokenFromCache(token gojwttoken.Token, id int64)
RevokeTokenFromCache logs the revoke token from cache event
func (*Logger) RevokeTokenFromCacheFailed ¶ added in v0.4.7
RevokeTokenFromCacheFailed logs the revoke token from cache failed event
func (*Logger) SetTokenToCache ¶ added in v0.4.3
func (l *Logger) SetTokenToCache(token gojwttoken.Token, id int64)
SetTokenToCache logs the set token to cache event
func (*Logger) SetTokenToCacheFailed ¶ added in v0.4.3
SetTokenToCacheFailed logs the set token to cache failed event
type TokenValidator ¶
type TokenValidator interface {
Set(
token gojwttoken.Token,
id string,
isValid bool,
expiresAt time.Time,
) error
Revoke(token gojwttoken.Token, id string) error
IsValid(token gojwttoken.Token, id string) (bool, error)
}
TokenValidator interface
type TokenValidatorService ¶
type TokenValidatorService struct {
// contains filtered or unexported fields
}
TokenValidatorService struct
func NewTokenValidatorService ¶
func NewTokenValidatorService(logger *Logger) *TokenValidatorService
NewTokenValidatorService creates a new token validator service
func (*TokenValidatorService) GetKey ¶ added in v0.4.2
func (t *TokenValidatorService) GetKey( token gojwttoken.Token, id string, ) (string, error)
GetKey gets the key for the cache
func (*TokenValidatorService) IsValid ¶ added in v0.4.7
func (t *TokenValidatorService) IsValid( token gojwttoken.Token, id string, ) (bool, error)
IsValid checks if a token is valid in the cache
func (*TokenValidatorService) Revoke ¶ added in v0.4.7
func (t *TokenValidatorService) Revoke( token gojwttoken.Token, id string, ) error
Revoke revokes a token in the cache
func (*TokenValidatorService) Set ¶
func (t *TokenValidatorService) Set( token gojwttoken.Token, id string, isValid bool, expiresAt time.Time, ) error
Set sets a token in the cache